【问题标题】:Add offset to a function?向函数添加偏移量?
【发布时间】:2016-03-07 14:22:21
【问题描述】:

我正在使用航点插件,需要帮助来修改偏移量。

在哪里添加 offset: '25%' ?链接:http://imakewebthings.com/waypoints/api/offset-option/

$.ajax({
    url: '//cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.0/jquery.waypoints.js',
    dataType: 'script',
    cache: true,
    success: function() {
        $('.element').waypoint(function(direction) 
            {
            if (direction === 'down') {
            alert('Alert notification')
            this.destroy();
            }
        });
    }
});

【问题讨论】:

    标签: jquery jquery-plugins offset jquery-waypoints


    【解决方案1】:

    据我所知,您应该能够传递一个选项对象,例如:

        $('.element').waypoint({
            offset: "25%",
            handler:function(direction){
                if (direction === 'down') {
                  alert('Alert notification')
                  this.destroy();
                }
            }
        });
    

    【讨论】:

      【解决方案2】:

      如果您检查此页面http://imakewebthings.com/waypoints/api/offset-option/,它表示要传递一个对象。使用处理程序方法触发警报。

      var waypoint = new Waypoint({
            element: document.getElementById('number-offset-negative'),
            handler: function(direction) {
              notify('25px past the top')
            },
            offset: -25
          })
      

      【讨论】:

        猜你喜欢
        • 2011-07-25
        • 1970-01-01
        • 2022-06-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-09-24
        • 1970-01-01
        相关资源
        最近更新 更多