如何使 jQGreyScale 与 Masonry 的无限滚动一起工作?
我正在开发一个博客主题,我需要帮助。我正在运行两个脚本,砖石脚本和灰度脚本。它们都有效,除了当无限滚动(砌体的一部分)将新照片添加到页面时,新照片不处于灰度模式。您可以在 http://jamestestblog4.tumblr.com 上实时观看。这是我正在使用的代码。如果有人能提供帮助,那就太好了。我是 JQuery 新手,不知道该怎么办。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://www.pryde-design.co.uk/projects/jQGreyScale/greyScale.js"></script>
<script>
$(function() {
$('.greyScale').hide().fadeIn(1000);
});
$(window).load(function () {
$('.greyScale').greyScale({
fadeTime: 500
});
});
</script>
{block:IndexPage}
<script src="http://masonry.desandro.com/jquery.masonry.min.js"></script>
<script src="http://masonry.desandro.com/js/jquery.infinitescroll.min.js"></script>
<script>
$(function(){
var $container = $('#content');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '#entry',
isAnimated : true
});
});
$container.infinitescroll({
navSelector : '#page-nav',
nextSelector : '#page-nav a',
itemSelector : '#entry',
loadingImg : "http://static.tumblr.com/kwz90l7/bIdlst7ub/transparent.png",
loadingText : " ",
donetext : " ",
isAnimated : true
},
function( newElements ) {
var $newElems = $( newElements ).css({ opacity: 0 });
$newElems.imagesLoaded(function(){
$newElems.animate({ opacity: 1 });
$container.masonry( 'appended', $newElems, true );
});
}
);
});
</script>
{/block:IndexPage}
I'm working on a blog theme and I need help. I have two scripts running, masonry and greyscale. They both work, except when infinitescrolling (part of masonry) adds the new photos to the page, the new photos aren't in greyscale mode. You can see this live at http://jamestestblog4.tumblr.com. Here is the code I'm using. If anyone can help, that'd be fantastic. I'm new to JQuery and don't know what to do.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://www.pryde-design.co.uk/projects/jQGreyScale/greyScale.js"></script>
<script>
$(function() {
$('.greyScale').hide().fadeIn(1000);
});
$(window).load(function () {
$('.greyScale').greyScale({
fadeTime: 500
});
});
</script>
{block:IndexPage}
<script src="http://masonry.desandro.com/jquery.masonry.min.js"></script>
<script src="http://masonry.desandro.com/js/jquery.infinitescroll.min.js"></script>
<script>
$(function(){
var $container = $('#content');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '#entry',
isAnimated : true
});
});
$container.infinitescroll({
navSelector : '#page-nav',
nextSelector : '#page-nav a',
itemSelector : '#entry',
loadingImg : "http://static.tumblr.com/kwz90l7/bIdlst7ub/transparent.png",
loadingText : " ",
donetext : " ",
isAnimated : true
},
function( newElements ) {
var $newElems = $( newElements ).css({ opacity: 0 });
$newElems.imagesLoaded(function(){
$newElems.animate({ opacity: 1 });
$container.masonry( 'appended', $newElems, true );
});
}
);
});
</script>
{/block:IndexPage}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你应该将
newElements
回调更改为如下所示:I think you should change your
newElements
callback to something like this: