1
我目前正試圖添加一個滑塊到網站,並遇到一個獲得良好的反饋(包括這裏在StackOverflow)稱爲FlexSlider - http://flex.madebymufffin.com/。基本上有兩種功能可以準備好開箱即用。一個圖像在一段時間後相互替換,第二個使用幻燈片動畫作爲過渡。FlexSlider淡入淡出但不會滑動?
我現在有3張帶有標題:
<div class="flexslider">
<ul class="slides">
<li>
<a href="http://...."><img src="../images/C.....jpg" />
<p class="flex-caption"><b>.text1..</b></p></a>
</li>
<li>
<a href="http://...."><img src="../images/C.....jpg" />
<p class="flex-caption"><b>.text2..</b></p></a>
</li><li>
<a href="http://...."><img src="../images/C.....jpg" />
<p class="flex-caption"><b>.text3..</b></p></a>
</li>
</ul>
</div>
這完美的作品的第一個功能,每幅影像顯示與匹配的標題。 但是,當我嘗試使用幻燈片動畫時遇到問題。正如滑塊的說明中所述,我在上面的代碼中添加了一個<div class="flex-container">
。我也改變了網頁內調用函數(如自己的筆記中指示):
<script type="text/javascript">
$(window).load(function() {
$('.flexslider').flexslider({
animation: "slide",
controlsContainer: ".flex-container"
});
});
</script>
然而,儘管圖像表現正常,所有標題都可見的所有的時間和他們完全不動...因此,這可能與div元素的定義存在錯誤有關,但我正在努力解決原因?有沒有其他人遇到類似的問題,這個滑塊或者你有什麼建議嗎?
相應的CSS是:
/* Browser Resets */
.flex-container a:active,
.flexslider a:active {outline: none;}
.slides,
.flex-control-nav,
.flex-direction-nav {margin: 0; padding: 0; list-style: none;}
/* FlexSlider Necessary Styles
*********************************/
.flexslider {width: 700px; margin: 0; padding: 0;}
.flexslider .slides > li {display: none;} /* Hide the slides before the JS is loaded. Avoids image jumping */
.flexslider .slides img {max-width: 100%; display: block;}
.flex-pauseplay span {text-transform: capitalize;}
/* Clearfix for the .slides element */
.slides:after {content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
html[xmlns] .slides {display: block;}
* html .slides {height: 1%;}
/* No JavaScript Fallback */
/* If you are not using another script, such as Modernizr, make sure you
* include js that eliminates this class on page load */
.no-js .slides > li:first-child {display: block;}
/* FlexSlider Default Theme
*********************************/
.flexslider {background: #fff; border: 4px solid #fff; position: relative; -webkit-border-radius: 5px; moz-border-radius: 5px; -o-border-radius: 5px; border-radius: 5px; zoom: 1;}
.flexslider .slides {zoom: 1;}
.flexslider .slides > li {position: center;}
/* Suggested container for "Slide" animation setups. Can replace this with your own, if you wish */
.flex-container {width:800px; zoom: 1; position: relative;}
/* Caption style */
/* IE rgba() hack */
.flex-caption {background:none; -ms-filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4C000000,endColorstr=#4C000000);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4C000000,endColorstr=#4C000000); zoom: 1;}
.flex-caption {margin: 0; width: 96%; padding: 2%; position: absolute; left: 0; bottom: 0; background: rgba(0,0,0,.3); color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.3); font-size: 14px; line-height: 18px;}
/* Direction Nav */
.flex-direction-nav li a {width: 52px; height: 52px; margin: -13px 0 0; display: block; background: url(../images/bg_direction_nav.png) no-repeat 0 0; position: absolute; top: 50%; cursor: pointer; text-indent: -9999px;}
.flex-direction-nav li .next {background-position: -52px 0; right: -21px;}
.flex-direction-nav li .prev {left: -20px;}
.flex-direction-nav li .disabled {opacity: .3; filter:alpha(opacity=30); cursor: default;}
/* Control Nav */
.flex-control-nav {width: 100%; position: absolute; bottom: -30px; text-align: center;}
.flex-control-nav li {margin: 0 0 0 5px; display: inline-block; zoom: 1; *display: inline;}
.flex-control-nav li:first-child {margin: 0;}
.flex-control-nav li a {width: 13px; height: 13px; display: block; background: url(../images/bg_control_nav.png) no-repeat 0 0; cursor: pointer; text-indent: -9999px;}
.flex-control-nav li a:hover {background-position: 0 -13px;}
.flex-control-nav li a.active {background-position: 0 -26px; cursor: default;}
提前許多感謝這個
泰勒,非常感謝您的幫助。這和我在.css文件中從GitHub賬戶更新的代碼已經排序了,謝謝! – Texas 2012-01-04 01:29:54