2016-03-04 104 views
-1

欢迎。我的网站存在一些问题,这些问题都是基于WordPress的。所以我创建了fullpane theme wordpress的网站,并且我想在右侧创建一些像索引“x部分的x”。你可以在http://emotivo.pl/nowe/找到它。我在网站的右侧思考01/05。 这应该以这种方式工作,当我滚动到底数应为01/05到05/05 我这是在页脚结束标记体更改div文本滚动底部jquery

<script> 
$(window).scroll(function(){ 
    var children = $("#superContainer").children(); 
    $(children).each(function(index,value) { 
    if($(value).hasClass("active")){ 
     $("div#date").html(index+" of "+ children.length); 
    } 
    }); 
}); 
</script> 

,帮助MI写之前添加脚本试图改变一些来自stackoverflow的人,但没有正常工作。 也许有人知道请求形式我的问? 请帮我解决我的问题。谢谢

回答

0

这是不正确的观看

$(window).scroll() 

通过检查你的网页我看到你的滚动项目有.scrollable类。

尝试观看

<script> 
$(document).ready(function(){ 
    $(document).on('scroll', '.scrollable', function(){ 
    var children = $("#superContainer").children(); 
    $(children).each(function(index,value) { 
    if($(value).hasClass("active")) 
     $("div#date").html(index+" of "+ children.length); 
    }); 
    }); 
}); 

在你的脚本。让我知道它是否有效!

+0

不幸的是工作..你告诉我,我应该在我的脚本中替换这个元素? – Dawid

+0

$('。scrollable')。scroll(function(){/ *把你的代码放在这里* /}) –

+0

我正在做你如何告诉我,但仍然无法工作。 – Dawid