Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery Carousel插件在单击时滚动到第一项_Jquery_Html_Plugins_Button_Carousel - Fatal编程技术网

jQuery Carousel插件在单击时滚动到第一项

jQuery Carousel插件在单击时滚动到第一项,jquery,html,plugins,button,carousel,Jquery,Html,Plugins,Button,Carousel,我正在使用这个jQuery插件:创建一个垂直旋转木马 我想做一些类似于分页的事情,单击一个按钮并滚动到相应的框架。但我只想要一个按钮。此按钮位于最后一帧之后,显示“返回顶部”。单击此按钮后,将滚动到旋转木马中的第一项。有人知道我如何轻松触发此事件吗?我想您需要jquery scrollTo插件: 下载插件的链接在该页面的右侧。我写了以下内容,我想这正是您想要实现的 <html> <head> <script type="text/javascript" s

我正在使用这个jQuery插件:创建一个垂直旋转木马


我想做一些类似于分页的事情,单击一个按钮并滚动到相应的框架。但我只想要一个按钮。此按钮位于最后一帧之后,显示“返回顶部”。单击此按钮后,将滚动到旋转木马中的第一项。有人知道我如何轻松触发此事件吗?

我想您需要jquery scrollTo插件:


下载插件的链接在该页面的右侧。

我写了以下内容,我想这正是您想要实现的

<html>
<head>
    <script type="text/javascript" src="http://sorgalla.com/projects/jcarousel/lib/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://sorgalla.com/projects/jcarousel/lib/jquery.jcarousel.min.js"></script>

    <link rel="stylesheet" type="text/css" href="http://sorgalla.com/projects/jcarousel/skins/tango/skin.css" />


    <script type="text/javascript">

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel(
    {
        vertical: true,
        scroll: 1
    });

    // Loop through all images and attach click action
    jQuery("#mycarousel img").each( function(index, element)
    {
        $(element).click( function()
        {
            jQuery('#mycarousel').jcarousel('scroll', index + 1);
        });
    });  
});

</script>
</head>

<body>

<ul id="mycarousel" class="jcarousel jcarousel-skin-tango">
    <li><img src="http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/75/199481072_b4a0d09597_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/57/199481087_33ae73a8de_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/77/199481108_4359e6b971_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/58/199481143_3c148d9dd3_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/72/199481203_ad4cdcf109_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/58/199481218_264ce20da0_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/69/199481255_fdfe885f87_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/60/199480111_87d4cb3e38_s.jpg" width="75" height="75" alt="" /></li>
    <li><img src="http://static.flickr.com/70/229228324_08223b70fa_s.jpg" width="75" height="75" alt="" /></li>
</ul>
</body>
</html>

jQuery(文档).ready(函数(){
jQuery(“#mycarousel”).jcarousel(
{
是的,
卷轴:1
});
//循环浏览所有图像并附加单击操作
jQuery(#mycarousel img”)。每个(函数(索引、元素)
{
$(元素)。单击(函数()
{
jQuery('mycarousel').jcarousel('scroll',index+1);
});
});  
});

很遗憾你选择了那个插件。我之所以避免使用它,有两个原因:除了设置,没有文档,也没有指向未压缩源代码的链接。谢谢,但我不需要一个插件。它的功能在那里,我需要找到如何触发它。帮助我做我需要做的事情+1