台灣最大程式設計社群網站
線上人數
841
 
會員總數:246087
討論主題:189663
歡迎您免費加入會員
討論區列表 >> AJAX / JSON / jQuery >> 使用jQuery做圖片切換效果,但圖片切換有問題,煩請各位大大幫忙解答
[]  
[我要回覆]
1
回應主題 加入我的關注話題 檢舉此篇討論 將提問者加入個人黑名單
使用jQuery做圖片切換效果,但圖片切換有問題,煩請各位大大幫忙解答
價值 : 10 QP  點閱數:739 回應數:1
樓主

Sai
門外漢
0 1
16 1
發送站內信

小弟正在自學html,css,javascript,jQuery等,
目前在使用FlexSlider 2做圖片切換的效果,
但是不知為何從第一張圖片中點擊向左移的箭頭切換成最後一張圖片時,
http://flexslider.woothemes.com/
不像以上網站中由最後一張圖片滑近來,
而是由第一張圖片滑過去在突然變成最後一張圖片,
不曉得這是甚麼原因,煩請各位大大幫忙解答,謝謝。
以下是程式碼
----------------------------------html-----------------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="">
<meta name="copyright" content="" />
<title></title>
<link rel="stylesheet" type="text/css" href="test.css" />
<link rel="stylesheet" type="text/css" href="flexslider.css" />
<script type="text/javascript" src="jquery-2.2.1.min.js"></script>
<script type="text/javascript" src="jquery.flexslider-min.js"></script>
</head>
<body class="loading">

<div id="wrapper">

<div id="container" class="cf">

<div id="main" role="main">
<div class="slider">
<div class="flexslider">

<div id="flex-viewport" class="flex-viewport">
<ul class="slides">
<li>
<img id="img01" src="img/IMAG0062.jpg">
</li>
<li>
<img id="img02" src="img/IMAG0063.jpg">
</li>
<li>
<img id="img03" src="img/IMAG0064.jpg">
</li>
<li>
<img id="img04" src="img/IMAG0065.jpg">
</li>
</ul>
</div>

<div id="flex-direction-div" class="flex-direction-div">
<ul class="flex-direction-nav">
<li class="flex-nav-prev">
<a class="flex-prev">Previous</a>
</li>
<li class="flex-nav-next">
<a class="flex-next">Next</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</body>

----------------------------jQuery-----------------------------------------

<script type="text/javascript">
$(window).load(function(){
$('.flexslider').flexslider({
animation: "slide",
start: function(slider){
$('body').removeClass('loading');
}
});
});
</script>

</html>

----------------------------CSS-----------------------------------------
/*
* jQuery FlexSlider v2.2.0
* http://www.woothemes.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (@mbmufffin)
*/


/* Browser Resets
*********************************/
.flex-container a:active,
.flexslider a:active,
.flex-container a:focus,
.flexslider a:focus {outline: none;}

.slides,
.flex-control-nav,
.flex-direction-nav {margin: 0; padding: 0; list-style: none;}


/* FlexSlider Necessary Styles
*********************************/
.flexslider {margin: 0; padding: 0;}
.flexslider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */
.flexslider .slides img {width: 100%; display: block;}
.flex-pauseplay span {text-transform: capitalize;}

/* Clearfix for the .slides element */
.slides:after {content: "\0020"; 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 { margin: 0 0 60px; background: #fff; border: 4px solid #fff; position: relative; -webkit-border-radius: 4px; -moz-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2); -moz-box-shadow: 0 1px 4px rgba(0,0,0,.2); -o-box-shadow: 0 1px 4px rgba(0,0,0,.2); box-shadow: 0 1px 4px rgba(0,0,0,.2); zoom: 1; }
.flex-viewport { max-height: 2000px; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; transition: all 1s ease; }
.loading .flex-viewport { max-height: 300px; }
.flexslider .slides { zoom: 1; }
.carousel li { margin-right: 5px; }

/* Direction Nav */
.flex-direction-nav {*height: 0;}
.flex-direction-nav a { text-decoration:none; display: block; width: 40px; height: 48px; margin: -20px 0 0; position: absolute; top: 50%; z-index: 10; overflow: hidden; opacity: 0; cursor: pointer; color: rgba(0,0,0,0.8); background:url("img/arr.png") no-repeat; text-indent:-999em }
.flex-direction-nav .flex-prev { left: -50px; background-position:0 0 }
.flex-direction-nav .flex-next { right: -50px; background-position:-132px 0}
.flexslider:hover .flex-prev { opacity: 0.7; left: 10px;}
.flexslider:hover .flex-next { opacity: 0.7; right: 10px;}
.flexslider:hover .flex-next:hover, .flexslider:hover .flex-prev:hover { opacity: 1; }
.flex-direction-nav .flex-disabled { opacity: 0!important; filter:alpha(opacity=0); cursor: default; }


/* Pause/Play */
.flex-pauseplay a { display: block; width: 20px; height: 20px; position: absolute; bottom: 5px; left: 10px; opacity: 0.8; z-index: 10; overflow: hidden; cursor: pointer; color: #000; background:#ddd}
.flex-pauseplay a:before { font-family: "flexslider-icon"; font-size: 20px; display: inline-block; content: '\f004'; }
.flex-pauseplay a:hover { opacity: 1; }
.flex-pauseplay a.flex-play:before { content: '\f003'; }

/* Control Nav */
.flex-control-nav {width: 100%; position: absolute; bottom: -40px; text-align: center;}
.flex-control-nav li {margin: 0 6px; display: inline-block; zoom: 1; *display: inline;}
.flex-control-paging li a {width: 11px; height: 11px; display: block; background: #666; background: rgba(0,0,0,0.5); cursor: pointer; text-indent: -9999px; -webkit-border-radius: 20px; -moz-border-radius: 20px; -o-border-radius: 20px; border-radius: 20px; -webkit-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); -moz-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); -o-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); box-shadow: inset 0 0 3px rgba(0,0,0,0.3); }
.flex-control-paging li a:hover { background: #333; background: rgba(0,0,0,0.7); }
.flex-control-paging li a.flex-active { background: #000; background: rgba(0,0,0,0.9); cursor: default; }

.flex-control-thumbs {margin: 5px 0 0; position: static; overflow: hidden;}
.flex-control-thumbs li {width: 25%; float: left; margin: 0;}
.flex-control-thumbs img {width: 100%; display: block; opacity: .7; cursor: pointer;}
.flex-control-thumbs img:hover {opacity: 1;}
.flex-control-thumbs .flex-active {opacity: 1; cursor: default;}

@media screen and (max-width: 860px) {
.flex-direction-nav .flex-prev { opacity: 1; left: 10px;}
.flex-direction-nav .flex-next { opacity: 1; right: 10px;}
}

----------------------------------end-----------------------------------------------------
小弟第一次發文,排版不好請見諒,感恩。

搜尋相關Tags的文章: [ html ] , [ css ] , [ javascript ] , [ jquery ] ,
本篇文章發表於2016-05-05 18:30
1樓
作者回應

Sai
檢舉此回應
不好意思,剛剛發現連最後一張切換到第一張也會有這樣的問題,煩請各位大大解答,謝謝。
本篇文章回覆於2016-05-05 18:35
== 簽名檔 ==
--未登入的會員無法查看對方簽名檔--
   
1

回覆
如要回應,請先登入.