- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在处理的网站使用的是 jquery waypoints 版本 3.1.1。我可以像这样从它的处理程序中销毁一个航路点:
var foo = $('#myElem').waypoint({
handler: function() {
// do something
this.destroy();
},
offset: 'bottom-in-view'
});
但不是这样的:
foo.destroy();
我得到错误:
foo.destroy is not a function
我也不能从上下文中销毁它:
var ctx = Waypoint.Context.findByElement($('#myElem'));
ctx.destroy();
我得到错误:
Cannot read property 'destroy' of undefined
我可以销毁航路点的唯一方法是从处理程序内部或使用 destroyAll:
Waypoint.destroyAll();
但我不能使用 destroyAll,因为页面上还有其他我不想销毁的 wyapoints。理想情况下,我可以像这样在每个航路点的基础上做到这一点:
foo.destroy();
或至少在上下文的基础上。这里有什么问题,我正在关注文档但没有得到预期的结果。可能是因为我使用的是旧版本?
最佳答案
foo 是一个数组,因此您需要这样写:
foo[0].destroy();
还可以从 imakewebthings.com/waypoints 考虑这一点:
There is one major difference between using the
$.fn.waypoint
method with versions 2.0 and 3.0. In 2.0, the same jQuery object was returned for chaining purposes, as is common among core jQuery methods. In 3.0, an array ofWaypoint
instances is returned.
关于javascript - 为什么我不能 destroy() 这些路标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35371812/
好的,所以,我正在为 Android 制作一个 Tumblr 客户端,我一直在尝试让 OAuth 工作大约一个星期,但一直未能成功。事情是这样的: 用户启动应用程序。主 Activity 的 onCr
过去一天我一直在努力为我的 Android 应用程序实现 OAuth。我遇到了一个又一个的问题。我只想签署一个请求,将其发送到网络服务并获得响应(我相信这是两条腿的方法)。 我已经下载了路标: -si
我是一名优秀的程序员,十分优秀!