【发布时间】:2015-05-02 15:59:58
【问题描述】:
我正在使用带有fullpage.js 的 ajax 来获取图库图像并在其上应用同位素,在我单击打开图库的链接(转到目标部分)后,页面的滚动不会出现,我不能滚动,但如果我重新调整浏览器的大小,滚动就会出现..
/* HTML */
<div class="section" id="textscroll">
<div class="s" data-anchor="stext">
<div class="container">
<div class="ajax_content"></div>
</div>
</div>
</div>
/* JS */
$('#fullpage').fullpage({
anchors: ['home', 'about', 'gallery'],
keyboardScrolling: false,
autoScrolling: true,
loopHorizontal: false,
scrollOverflow: true,
controlArrows: false
});
$('.gallery-link').on('click','a',function(){
var url = "directory/gallery_ajax.php";
var postid = $(this).attr('data-post');
$('.loading').addClass('active');
$.ajax({
type : 'post',
url : url,
data : {
action : 'user_clicked',
postid : postid
},
success : function( response ) {
$('.ajax_content').html('<div class="content" id="gallery-container"><div class="isotope">'+response+'</div></div>');
var $container = $('.isotope').isotope({
itemSelector: '.item',
masonry: {
columnWidth: 160,
isFitWidth: true
}
});
$container.imagesLoaded( function() {
$('.loading').removeClass('active');
$.fn.fullpage.moveTo(3,0);
$container.isotope( 'layout' );
});
},
error: function( message ){
console.log(message);
}
});
return false;
});
【问题讨论】:
-
"$('.ajax_content').html "在你的响应函数中是滚动html的内容吗?
-
是的,它包含大约 50 张图片,滚动应该应用于整个页面(部分)
标签: javascript jquery ajax fullpage.js slimscroll