当前位置: 代码迷 >> JavaScript >> jquery没法捕捉到scroll
  详细解决方案

jquery没法捕捉到scroll

热度:233   发布时间:2013-01-17 10:28:54.0
jquery无法捕捉到scroll

var tuodong = true;
$(document).ready(function(){
    //获取毛标签的位置
    var pos = $('#loading').offset();
    $(window).scroll(function(){
        if($('.goods_con2').attr('conscroll') == 'yes')
        {
        var aid = $('#loading').attr('aid');
        if((parseInt($(document).scrollTop()) + parseInt($(window).height())) > parseInt(pos.top))
        {
            if(aid == 'yes' && tuodong)
            {
                var num = parseInt($('#pageNum').val()) + 1;
                var goodsId = $('#goods_id').val();
                var result = '';
                tuodong = false;
                $.ajax({
                    url:'/detail/voteajax.php',
                    type:'POST',
                    cache: false,
                    dataType:'json',
                    data:{'votes':'dyvote','goods_id':goodsId,'pageNum':num},
                    success:function(data){
                        $('#pageNum').val(data.pagenum);
                        $('#loading').attr('aid',data.param);
                        var objs = data.comments;
                        if(data.param == 'yes')
                        {                                   
                            tuodong = true;
                            for(var i = 0;i<objs.length;i++)
  相关解决方案