【问题标题】:Scroller is not working in javascript滚动条在 javascript 中不起作用
【发布时间】:2016-11-18 04:40:51
【问题描述】:

我正在运行 javascript 以在图像放大时向下滚动图像,但滚动条不起作用 这是脚本

    $(function(){
     // Add a custom filter to recognize images from lorempixel (that don't end with ".jpg" or something similar)
            $.tosrus.defaults.media.image = {
                filterAnchors: function( $anchor ) {
                return $anchor.attr( 'href' ).indexOf( 'cdn.shopify.com' ) > -1;
                }
            };

            $('#example-2 a').tosrus({
                pagination  : {
                    add         : true
                },
                caption     : {
                    add         : true
                },
                slides      : {
                    scale       : 'fill'
                }
            });
        });

【问题讨论】:

    标签: javascript jquery shopify scroller


    【解决方案1】:

    试试这个

    $('#event-list').scroll(function() {
    var curScroll = $(this)[0].scrollTop,
        maxScroll = $(this)[0].scrollHeight - $(this).height();
    
    console.log(curScroll, ' :: ', maxScroll);
    
    if ((curScroll >= maxScroll - 200) && !loading) {
        loading = true;
    
        $(this)[0].scrollTop = curScroll;
    
        $('.loading').fadeIn('fast');
    
        if (page <= $('.page').length) {
            loadMore();
        }
    }
    

    });

    【讨论】:

      猜你喜欢
      • 2014-01-09
      • 2018-03-12
      • 1970-01-01
      • 2014-01-19
      • 2016-12-11
      • 1970-01-01
      • 1970-01-01
      • 2023-01-30
      相关资源
      最近更新 更多