如何优雅地从 Jquery 轮播降级为 css 滚动列表
更新
我将这两行添加到下面的脚本中:我运行了调试器,执行似乎正在删除属性,但网页继续显示滚动条。
$("#newsticker-demo").removeAttr("overflow-y");
$("#newsticker-demo").removeAttr("height");
<script type="text/javascript" language="javascript">
$(function () {
$(".newsticker-jcarousellite").jCarouselLite({
vertical: true,
visible: 1,
auto: 1,
speed: 8000,
circular: true
});
$("#newsticker-demo").removeAttr("overflow-y");
$("#newsticker-demo").removeAttr("height");
});
</script>
-- IE8 是我现在最关心的问题 --
您好,在我们的主页上有一个垂直滚动的轮播。我想做的是,如果关闭 javascript,让它优雅地无法仅使用 css。因此,结果是带有垂直滚动条的文本,用户可以单击并拖动以在列表中移动。类似于您在 textarea 元素上发现的内容,它有太多数据无法一次显示。
链接到主页。 http://beta.sc-pa.com/home/pasite-home.asp
完成后。
update
I added these two lines to the script below: I ran the debugger and the execution appears to be removing the attributes, but the webpage continues to show the scroll bar.
$("#newsticker-demo").removeAttr("overflow-y");
$("#newsticker-demo").removeAttr("height");
<script type="text/javascript" language="javascript">
$(function () {
$(".newsticker-jcarousellite").jCarouselLite({
vertical: true,
visible: 1,
auto: 1,
speed: 8000,
circular: true
});
$("#newsticker-demo").removeAttr("overflow-y");
$("#newsticker-demo").removeAttr("height");
});
</script>
-- IN IE8 is my number 1 concern right now --
Hello, On our homepage there is a vertical scrolling carousel. What I want to do is have it gracefully fail to use only css if javascript is turned off. So that the result is text with a vertical scroll bar the user can click and drag to move through the list. Similar to what you mind find on a textarea element, that has too much data to display at once.
link to homepage. http://beta.sc-pa.com/home/pasite-home.asp
Once this is done.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将从一个无需 JavaScript 的解决方案开始,然后应用滚动轮播,并在必要时操作 DOM。基本概念很简单:带有
overflow-y: auto
的固定高度容器请参阅示例< /a>.
样式是 CSS 值,而不是直接归因于元素,要使用 jQuery 操作样式,请使用
css()
函数。I would start with a solution that works sans-Javascript, then apply your scrolling carousel, manipulating the DOM if necessary. The basic concept is easy: a fixed height container with
overflow-y: auto
See example.
The styles are CSS values rather than attributed direct on the element, to manipulate styles with jQuery use the
css()
function.