- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
smoothDivScroll如果在 $(window).load()
内调用,1.3 对我来说会失败。看这个jsFiddle .
.load() 事件处理程序已弃用,因此我尝试使用 imagesLoaded jQuery 插件如下:
(function ($) { if($('.scroller').length)
$('.scroller').imagesLoaded(function() {
$('.scroller').smoothDivScroll({});
});
})(jQuery);
但这在 Safari、Chrome 和 Opera 中也失败了。这些浏览器的控制台中不会显示任何错误。但它可以在 Firefox 中运行。浏览器版本是最新的。
有什么想法为什么会失败吗?
最佳答案
您粘贴的代码片段失败,因为执行该函数时不一定会加载 .scroller
,因此返回 length
为 0。只需将其放入 $(document).ready
处理程序。或简称:
$(function() {
$('.scroller').smoothDivScroll({});
});
JSFiddle 为您添加了该功能,但在您的脚本中,您需要将依赖于 DOM 元素的代码包装到这样的函数中。
关于jquery - 如果在 .load() 事件处理程序中运行,smoothDivScroll 会失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15856607/
我在我的网站中使用 smoothdivscroll 插件来实现缩略图功能。除了 iPad 浏览器(我还没有在 iPhone 浏览器中进行测试)之外,桌面浏览器中的一切都运行良好。这是我的 JavaSc
我在一个网站上工作,该网站将在 http://www.smoothdivscroll.com 中容纳大约 200 多张图片。布局 问题是我们需要加入某种惰性加载。我遇到的主要问题是视口(viewpor
我正在使用smootdivscroll 在网站上显示产品。产品全部加载到一个大 div 中,然后使用 smootdivscroll 脚本左右滚动。我在左侧和右侧设置了箭头,当悬停或单击时滚动。 我想禁
我正在尝试动态加载 smoothdivscroll(这样我的网站上就可以有很多画廊)。 静态 html 工作正常。一旦我尝试为动态加载的内容启用该插件,它就不起作用。 这似乎是一个时机问题。我注意到,
我在将脚本 smoothdivscroller 集成到页面内容时遇到问题,并且由于我对 html、css 和 js 的了解非常薄弱,所以我找不到问题 -- 这是我的主题 .info 文件 http:/
我目前正在将 smoothdivscroll 与混合媒体可变宽度类结合使用 - 它实际上并未设置为这样做(它喜欢所有类都是固定宽度的,但添加了空白代码似乎大部分工作正常。 我遇到的问题是,当页面加载内
我正在尝试让 jQuery 插件 SmoothDivScroll ( http://www.smoothdivscroll.com/ ) 从其包含的内容的中心开始,以便在加载时向左和向右显示滚动条。我
我在让 SmoothDivScroll 插件与 Google Chrome 配合使用时遇到问题。但它在 FF 和 IE7 及以上版本中运行良好。我尝试过使用CSS,但没有结果。 插件是这个http:/
smoothDivScroll如果在 $(window).load() 内调用,1.3 对我来说会失败。看这个jsFiddle . .load() 事件处理程序已弃用,因此我尝试使用 imagesLo
我目前正在使用 SmoothDivScroll 来实现图像的滚动流。但是,左边的 Hotspot 太快了,而 Right Hotspot 似乎 react 不正常。 我设置了一个 fiddle 来展示
我有这个照片库http://lifelistchase.com/japan-photo-gallery 每张图片都会作为 WordPress 帖子上传并插入。缩略图 (the_post_thumbna
实际上我正在尝试将 anchor 标记与此 slider 图像一起使用 Top websites 但是当我这样做时,它的无效图像没有显示出来?我不想要替代方法.. 这个 slid
我是一名优秀的程序员,十分优秀!