jquery插件bxslider用法實(shí)例分析
本文實(shí)例講述了jquery插件bxslider用法。分享給大家供大家參考。具體用法如下:
首先調(diào)用對(duì)應(yīng)js文件:
<script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.bxslider.js"></script>
jQuery代碼部分:
$(function(){ $('#marquee').bxSlider({ mode:'vertical', //默認(rèn)的是水平 displaySlideQty:1,//顯示li的個(gè)數(shù) moveSlideQty: 1,//移動(dòng)li的個(gè)數(shù) captions: true,//自動(dòng)控制 auto: true, controls: false//隱藏左右按鈕 }); });
HTML結(jié)構(gòu)如下:
<div style="width:450px; height:296px; float:left; overflow:hidden; margin-left:200px;"> <ul id="marquee"> <li> <img src="img/1.jpg" alt="banner_美容" style="width:450px; height:296px;"> </li> <li> <img src="img/2.jpg" alt="banner_美容" style="width:450px; height:296px;"> </li> </ul> </div>
CSS定義左右按鈕樣式:
.bx-prev{ width:12px; height:26px; background:#f00;text-indent: -999999px;z-index: 999; position: absolute; float:left; left:455px; top:110px; } .bx-next{ width:12px; height:26px; background:#f00; text-indent: -999999px; z-index: 999; position: absolute; top:110px;left:-15px; }
參數(shù)說(shuō)明:
bxSlider 詳細(xì)配置參數(shù):
bxSlider有很多配置參數(shù),使你能夠用參數(shù)制作出各種各樣的slider效果:
mode: 'horizontal', // 'horizontal', 'vertical', 'fade' 定義slider滾動(dòng)的方向,有三個(gè)值可供選擇
infiniteLoop: true, // true, false - display first slide after last 無(wú)限循環(huán)
hideControlOnEnd: false, // true, false - if true, will hide 'next' control on last slide and 'prev' control on first 如果設(shè)置true,將會(huì)在最后一個(gè)幻燈片隱藏“next”,在最前面的幻燈片因此“prev”
controls: true, // true, false - previous and next controls 是否顯示“previous”和“next”按鈕
speed: 500, // integer - in ms, duration of time slide transitions will occupy 速度,單位為毫秒
easing: 'swing', // used with jquery.easing.1.3.js - see http://gsgd.co.uk/sandbox/jquery/easing/ for available options
pager: true, // true / false - display a pager
pagerSelector: null, // jQuery selector - element to contain the pager. ex: '#pager'
pagerType: 'full', // 'full', 'short' - if 'full' pager displays 1,2,3... if 'short' pager displays 1 / 4 如果設(shè)置full,將顯示1,2,3……,如果設(shè)置short,將顯示1/4 .
pagerLocation: 'bottom', // 'bottom', 'top' - location of pager 頁(yè)碼的位置
pagerShortSeparator: '/', // string - ex: 'of' pager would display 1 of 4 頁(yè)面分隔符
pagerActiveClass: 'pager-active', // string - classname attached to the active pager link 當(dāng)前頁(yè)碼的className
nextText: 'next', // string - text displayed for 'next' control 下一頁(yè)的文字
nextImage: '', // string - filepath of image used for 'next' control. ex: 'images/next.jpg' 可以設(shè)置下一頁(yè)為圖片
nextSelector: null, // jQuery selector - element to contain the next control. ex: '#next'
prevText: 'prev', // string - text displayed for 'previous' control 上一頁(yè)的文字
prevImage: '', // string - filepath of image used for 'previous' control. ex: 'images/prev.jpg' 上一頁(yè)的圖片
prevSelector: null, // jQuery selector - element to contain the previous control. ex: '#next'
captions: false, // true, false - display image captions (reads the image 'title' tag) 是否顯示圖片的標(biāo)題,讀取圖片的title屬性的內(nèi)容。
captionsSelector: null, // jQuery selector - element to contain the captions. ex: '#captions'
auto: false, // true, false - make slideshow change automatically 幻燈片自動(dòng)滾動(dòng)
autoDirection: 'next', // 'next', 'prev' - direction in which auto show will traverse 自動(dòng)滾動(dòng)的順序
autoControls: false, // true, false - show 'start' and 'stop' controls for auto show 自動(dòng)滾動(dòng)的控制鍵
autoControlsSelector: null, // jQuery selector - element to contain the auto controls. ex: '#auto-controls'
autoStart: true, // true, false - if false show will wait for 'start' control to activate
autoHover: false, // true, false - if true show will pause on mouseover 設(shè)置鼠標(biāo)mouseover將會(huì)使自動(dòng)滾動(dòng)暫停
autoDelay: 0, // integer - in ms, the amount of time before starting the auto show
pause: 3000, // integer - in ms, the duration between each slide transition 過(guò)渡時(shí)間
startText: 'start', // string - text displayed for 'start' control 開(kāi)始按鈕的文字
startImage: '', // string - filepath of image used for 'start' control. ex: 'images/start.jpg' 開(kāi)始按鈕的圖片
stopText: 'stop', // string - text displayed for 'stop' control 停止按鈕的文本
stopImage: '', // string - filepath of image used for 'stop' control. ex: 'images/stop.jpg' 停止按鈕的圖片
ticker: false, // true, false - continuous motion ticker mode (think news ticker)
// note: autoControls and autoControlsSelector apply to ticker!
tickerSpeed: 5000, // integer - has an inverse effect on speed. therefore, a value of 10000 will
// scroll very slowly while a value of 50 will scroll very quickly.
tickerDirection: 'next', // 'next', 'prev' - direction in which ticker show will traverse
tickerHover: false, // true, false - if true ticker will pause on mouseover
wrapperClass: 'bx-wrapper', // string - classname attached to the slider wraper
startingSlide: 0, // integer - show will start on specified slide. note: slides are zero based!
displaySlideQty: 1, // integer - number of slides to display at once
moveSlideQty: 1, // integer - number of slides to move at once
randomStart: false, // true, false - if true show will start on a random slide
希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。
相關(guān)文章
jQuery實(shí)現(xiàn)滾動(dòng)條滾動(dòng)到子元素位置(方便定位)
本文主要介紹了jQuery實(shí)現(xiàn)滾動(dòng)條滾動(dòng)到子元素位置的方法。具有一定的參考價(jià)值,下面跟著小編一起來(lái)看下吧2017-01-01jQuery實(shí)現(xiàn)DIV響應(yīng)鼠標(biāo)滑過(guò)由下向上展開(kāi)效果示例【測(cè)試可用】
這篇文章主要介紹了jQuery實(shí)現(xiàn)DIV響應(yīng)鼠標(biāo)滑過(guò)由下向上展開(kāi)效果,涉及jQuery基于事件響應(yīng)結(jié)合stop與animate方法控制頁(yè)面元素屬性動(dòng)態(tài)變換相關(guān)操作技巧,需要的朋友可以參考下2018-04-04用圖片替換checkbox原始樣式并實(shí)現(xiàn)同樣的功能
這篇文章主要介紹了用圖片替換checkbox原始樣式并實(shí)現(xiàn)同樣的功能 ,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2018-11-11JQuery實(shí)現(xiàn)簡(jiǎn)單時(shí)尚快捷的氣泡提示插件
在程序提交后,為了提高用戶(hù)體驗(yàn)我們需要驗(yàn)證并提示出錯(cuò)的位置,利用JQuery我們可以輕松實(shí)現(xiàn)氣泡提示,需要的朋友可以了解下2012-12-12深入理解JQuery keyUp和keyDown的區(qū)別
這篇文章主要是對(duì)JQuery中keyUp與keyDown的區(qū)別進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2013-12-12select標(biāo)簽?zāi)M/美化方法采用JS外掛式插件
select標(biāo)簽的外觀(guān)問(wèn)題很惱人,各個(gè)瀏覽器都不一致,單單就IE,一個(gè)版本就一個(gè)長(zhǎng)相,還不能用CSS修飾,接下來(lái)將本人對(duì)select的美化方法共享出來(lái),感興趣的朋友可以參考下2013-04-04基于jQuery的前端數(shù)據(jù)通用驗(yàn)證庫(kù)
做了這么長(zhǎng)時(shí)間的開(kāi)發(fā),一直因?yàn)轵?yàn)證的問(wèn)題相當(dāng)?shù)目鄲?,不斷的?xiě)很多重復(fù)的代碼,對(duì)想偷懶的我來(lái)說(shuō)是相當(dāng)痛苦的。2011-08-08jquery實(shí)現(xiàn)異步加載圖片(懶加載圖片一種方式)
本篇文章主要介紹了jquery實(shí)現(xiàn)異步加載(懶加載圖片一種方式),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。2017-04-04