[英]image slideshow not working
I followed this jsfiddle and created gallery that slideshow I would see in main page. 我遵循了这个jsfiddle,并创建了可以在主页上看到的幻灯片展示的库。 I tried to move to another file, but without success.
我试图移动到另一个文件,但是没有成功。 Inside jsfiddle it works just great but inside my app fails.
在jsfiddle内部,它工作得很好,但是在我的应用程序内部失败。 When I checked if i am requiring all these files correctly it seemed ok.
当我检查我是否正确要求所有这些文件时,一切正常。
My view : 我的观点 :
<!-- "previous page" action -->
<a class="prev browse left"></a>
<!-- root element for scrollable -->
<div class="scrollable" id=chained>
<!-- root element for the items -->
<div class="items">
<!-- 1-5 -->
<div>
<%= link_to image_tag("EMILIANA_BANNERS.png", :width=> '470', :height=> '260') %>
<div class="caption-bkgd"></div>
<div class="caption">Emiliana Products</div>
</div>
<div>
<%= link_to image_tag("tractors and machinery.png", :width=> '470', :height=> '260') %>
<div class="caption-bkgd"></div>
<div class="caption">Tractors and machinery</div>
</div>
<!-- "previous page" action -->
<a class="prev browse left"></a>
<!-- root element for scrollable -->
<div class="scrollable" id=chained>
<!-- root element for the items -->
<div class="items">
<!-- 1-5 -->
<div>
<%= link_to image_tag("EMILIANA_BANNERS.png", :width=> '470', :height=> '260') %>
<div class="caption-bkgd"></div>
<div class="caption">Emiliana Products</div>
</div>
<div>
<%= link_to image_tag("tractors and machinery.png", :width=> '470', :height=> '260') %>
<div class="caption-bkgd"></div>
<div class="caption">Tractors and machinery</div>
</div>
</div>
My inner js code 我的内部js代码
$(document).ready(function () {
$("#chained").scrollable({
circular: true,
mousewheel: true,
onSeek: function () {
$('.caption').fadeIn('fast');
},
onBeforeSeek: function () {
$('.caption').fadeOut('fast');
}
}).navigator().autoscroll({
interval: 6000
});
});
My css file : 我的css文件:
a:active {
outline:none;
}
:focus {
-moz-outline-style:none;
}
/*
root element for the scrollable.
when scrolling occurs this element stays still.
*/
.scrollable {
/* required settings */
position:relative;
overflow:hidden;
width: 470px;
height:260px;
background-color: #d9d9d9;
}
/*
root element for scrollable items. Must be absolutely positioned
and it should have a extremely large width to accomodate scrollable items.
it's enough that you set the width and height for the root element and
not for this element.
*/
.scrollable .items {
/* this cannot be too large */
width:20000em;
position:absolute;
clear:both;
height: 260px;
}
.items div {
float:left;
width:470px;
}
/* single scrollable item */
.scrollable img {
float:left;
margin:0;
background-color:#fff;
width:470px;
height:260px;
position: relative;
}
.scrollable img.hover {
background-color:#123;
}
.scrollable .caption {
color: #fff;
position: absolute; bottom: 12px;
padding-left: 18px;
font: bold 14px arial;
}
.scrollable .caption-bkgd {
background-color: #000;
height: 40px;
position: absolute; bottom: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
-moz-opacity: 0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
/* active item */
.scrollable .active {
border:2px solid #000;
position:relative;
cursor:default;
}
/* position and dimensions of the navigator */
.navi {
margin: -26px 0 0 0;
position: absolute; left: 400px;
width:200px;
height:13px;
z-index: 9999;
}
/* NAVIGATOR */
.navi a {
width:13px; height:13px;
float:left;
margin:0 4px;
background-color: #d9d9d9;
display:block;
}
.navi a:hover, .navi a.active {background-color: green;}
.hide{display: none;}
I tried to move code inside view but without succes. 我试图在视图内移动代码,但没有成功。
you need to add this js : http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js 您需要添加以下js: http : //cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js
and this sliding use jquery 1.4.2 check it your jquery version (also I use 1.6.4-1.8.3 its worked..) 并且此滑动使用jQuery 1.4.2检查它您的jQuery版本(我也使用1.6.4-1.8.3它的工作..)
I copy your code and its worked : http://jsfiddle.net/mehmetakifalp/BxcCq/ 我复制了您的代码及其工作方式: http : //jsfiddle.net/mehmetakifalp/BxcCq/
$("#chained").scrollable({
circular: true,
mousewheel: true,
onSeek: function () {
$('.caption').fadeIn('fast');
},
onBeforeSeek: function () {
$('.caption').fadeOut('fast');
}
}).navigator().autoscroll({
interval: 6000
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.