0
我使用傳送帶從我的服務器上循環顯示圖像。在每個傳送帶上的Disqus評論圖片
我要添加到每個轉盤圖片一disqus線程徵求意見
我的代碼將圖像添加到我的旋轉木馬並將其顯示如下:
$('#imgModal').on('show.bs.modal', function(event) {
var indicators = $(this).find('.carousel-indicators');
var items = $(this).find('.carousel-inner');
var targPath = $(event.relatedTarget).attr('src').split('/');
var imgsPath = targPath.splice(0, targPath.length - 3).join('/') + '/';
var target = {
date: targPath[0],
category: targPath[1],
name: targPath[2]
};
// Lister les répertoires (dates)
$.ajax({
url: imgsPath,
success: function(data) {
var dates = [];
var date;
$(data).find('a').each(function() {
date = $(this).attr('href').replace(/\/$/, '');
if (date.match(/[0-9]{6}$/)) dates.push(date);
dates.sort();
});
var i = 0;
var path;
dates.forEach(function(date) {
// Vérifer que le fichier existe
path = imgsPath + date + '/' + target['category'] + '/' + target['name'];
$.ajax({
url: path,
async: false,
success: function() {
// L'ajouter au carousel
item = $(
'<div class="item">'+
'<img src="'+path+'" alt="'+target['name']+'">'+
'<div class="carousel-caption">'+
'<h3>'+date+'</h3>'+
'<p>'+target['name']+'</p>'+
'</div>'+
'</div>'
).appendTo(items);
indicator = $('<li data-target="#carousel-example-generic" data-slide-to="'+i+'"></li>').appendTo(indicators);
// Afficher l'image cliquée
if (date == target['date']) {
item.addClass('active');
indicator.addClass('active');
}
i++;
}
});
});
}
});
});
,我想我的disqus整合腳本我的每一個在輪播圖片的:
disqus腳本:
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'nedox149';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>