日期:2014-05-16  浏览次数:20466 次

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;