自动滑动 jQuery jCarousel Lite 不工作

发布于 2024-12-13 18:14:19 字数 1865 浏览 2 评论 0原文

我有一个 div 它包含这样的元素:

 <div class='anyClass' style='float:left'>
 <ul class="slider_ctre" id="mycarousel">
    <li class="outer_prdcts"><asp:HyperLink ID="hyp0" runat="server"   NavigateUrl="http://192.168.20.120/tabid/62/Gifts+++Jewelery/HOuse+Of+Jamal+Attar/Jamal+Collection/0/SKU/1016-1637-2699-0/Default.aspx"><img class="prdct_img_blue" src="/Portals/_default/images/image_1.jpg" alt='' width='100' height='100' /></asp:HyperLink></li>
    <li class="outer_prdcts"><asp:HyperLink ID="hyp1" runat="server" NavigateUrl="http://192.168.20.120/tabid/62/Gifts+++Jewelery/HOuse+Of+Jamal+Attar/Jamal+Collection/0/SKU/1016-1637-2699-0/Default.aspx"><img class="prdct_img_blue" src='/Portals/_default/images/image_2.jpg' alt='' width='100' height='100' /></asp:HyperLink></li>
    <li class="outer_prdcts"><img class="prdct_img_blue" src='/Portals/_default/images/image_3.jpg' alt='' width='100' height='100' /></li>
    <li class="outer_prdcts"><img class="prdct_img_blue" src='/Portals/_default/images/image_4.jpg' alt='' width='100' height='100' /></li>
    <li class="outer_prdcts"><img class="prdct_img_blue" src='/Portals/_default/images/image_5.jpg' alt='' width='100' height='100' /></li>
    <li class="outer_prdcts"><img class="prdct_img_blue" src='/Portals/_default/images/image_6.jpg' alt='' width='100' height='100' /></li>
 </ul>

 </div>

我正在使用 jQuery jCarousel Lite 来滑动这些图像。我的要求是如何在鼠标悬停时停止滚动?

jQuery 是:

   <script type='text/javascript' language='javascript'>
   $(function() {
    $('.anyClass').jCarouselLite({
    btnNext: '.next',
    btnPrev: '.prev',
    auto: 200
    });

    });
   </script>

I have a div and it contains elements like this:

 <div class='anyClass' style='float:left'>
 <ul class="slider_ctre" id="mycarousel">
    <li class="outer_prdcts"><asp:HyperLink ID="hyp0" runat="server"   NavigateUrl="http://192.168.20.120/tabid/62/Gifts+++Jewelery/HOuse+Of+Jamal+Attar/Jamal+Collection/0/SKU/1016-1637-2699-0/Default.aspx"><img class="prdct_img_blue" src="/Portals/_default/images/image_1.jpg" alt='' width='100' height='100' /></asp:HyperLink></li>
    <li class="outer_prdcts"><asp:HyperLink ID="hyp1" runat="server" NavigateUrl="http://192.168.20.120/tabid/62/Gifts+++Jewelery/HOuse+Of+Jamal+Attar/Jamal+Collection/0/SKU/1016-1637-2699-0/Default.aspx"><img class="prdct_img_blue" src='/Portals/_default/images/image_2.jpg' alt='' width='100' height='100' /></asp:HyperLink></li>
    <li class="outer_prdcts"><img class="prdct_img_blue" src='/Portals/_default/images/image_3.jpg' alt='' width='100' height='100' /></li>
    <li class="outer_prdcts"><img class="prdct_img_blue" src='/Portals/_default/images/image_4.jpg' alt='' width='100' height='100' /></li>
    <li class="outer_prdcts"><img class="prdct_img_blue" src='/Portals/_default/images/image_5.jpg' alt='' width='100' height='100' /></li>
    <li class="outer_prdcts"><img class="prdct_img_blue" src='/Portals/_default/images/image_6.jpg' alt='' width='100' height='100' /></li>
 </ul>

 </div>

I am using jQuery jCarousel Lite to slide these images. My requirement is how can I stop its scrolling on mouseover?

jQuery is:

   <script type='text/javascript' language='javascript'>
   $(function() {
    $('.anyClass').jCarouselLite({
    btnNext: '.next',
    btnPrev: '.prev',
    auto: 200
    });

    });
   </script>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野侃 2024-12-20 18:14:19

显然, jCarousel Lite 不提供暂停选项。

这里有一个关于对 jCarousel Lite 进行修改的讨论添加暂停选项。

根据jCarousel上的评论Lite 网站,对未压缩的 jcarousellite.js 文件的修改如下:

将其添加到选项列表中(在 o = $.extend({ line)。

pause: false

找到此部分:

if(o.auto)
        setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);

并将其替换为:

if(o.auto)
    aktiv = setInterval(function() {
        go(curr+o.scroll);
    }, o.auto+o.speed);

if(o.pause)
    div.mouseover(function() {
        clearInterval(aktiv);
    });
    div.mouseout(function() {
        aktiv = setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);
    });

在您的 jCarouselLite() 参数中,像这样包含它...

pause: true

Apparently, jCarousel Lite does not offer the pause option.

There is a discussion here about making a modification to jCarousel Lite to add a pause option.

According to comments on the jCarousel Lite website, the modifications to the un-minified jcarousellite.js file are as follows:

Add this to the list of options (under the o = $.extend({ line).

pause: false

Find this section:

if(o.auto)
        setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);

And replace it with this:

if(o.auto)
    aktiv = setInterval(function() {
        go(curr+o.scroll);
    }, o.auto+o.speed);

if(o.pause)
    div.mouseover(function() {
        clearInterval(aktiv);
    });
    div.mouseout(function() {
        aktiv = setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);
    });

Within your jCarouselLite() parameters, include it like this...

pause: true
东风软 2024-12-20 18:14:19

如果您在页面上,

如果两个或多个运行 jCarouselLite,

变量o需要在aktiv中显式添加扩展对象。

o = $.extend({
    aktiv: null,
    pause: false

更改了 o.aktiv

并且 aktiv在代码之前 :aktiv
代码后:o.aktiv

if(o.auto)
    o.aktiv = setInterval(function() {
        go(curr+o.scroll);
    }, o.auto+o.speed);

if(o.pause) {
    div.mouseover(function() {
        clearInterval(o.aktiv);
    });
    div.mouseout(function() {
        o.aktiv = setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);
    });
}

完成了:D

If you are on a page,

and if two or more runs jCarouselLite,

variables o need to explicitly add the extension object in aktiv.

o = $.extend({
    aktiv: null,
    pause: false

and aktiv changes o.aktiv

before code: aktiv
after code: o.aktiv

if(o.auto)
    o.aktiv = setInterval(function() {
        go(curr+o.scroll);
    }, o.auto+o.speed);

if(o.pause) {
    div.mouseover(function() {
        clearInterval(o.aktiv);
    });
    div.mouseout(function() {
        o.aktiv = setInterval(function() {
            go(curr+o.scroll);
        }, o.auto+o.speed);
    });
}

finished :D

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文