FlexSlider2

真棒,响应jQuery滑块工具包。

  • 简单,语义标记
  • 支持所有主流浏览器
  • 水平/垂直滑动和淡入淡出动画
  • 支持多个滑块,
  • 硬件加速,支持触摸
  • 自定义导航选项
  • 兼容最新版本的jQuery

FlexSlider2 是woothemes出品的优秀幻灯片插件

FlexSlider是小巧的jQuery内容滚动插件,压缩后只有4KB大小。它能简单的创建内容滚动的效果,具有非常高的可定制性。它是将UL列表转换成内容滚动的列表,可以自动播放,或者使用导航按钮和键盘来控制。

下载演示地址

项目首页: www.woothemes.com/flexslider/

项目库地址:github.com/woothemes/FlexSlider

演示地址:flexslider.woothemes.com/

官方下载:https://github.com/woothemes/FlexSlider/zipball/master

本地下载:woothemes-FlexSlider-version-2.1-7-ga4647ed

安装方法:

步骤1 - 链接文件

这些项目添加到您的文档<HEAD>链接核心jQuery(如果您已经安装了JQ这个可以省略)和FlexSlider的CSS / JS文件到您的网页。您也可以选择到自己的服务器上托管的jQuery

<!-- 插入代码到 <head>  -->
<link rel="stylesheet" href="flexslider.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="jquery.flexslider.js"></script>

 

第2步 - 添加标记

的FlexSlider标记是简单明了。首先,启动一个单独的包含元素,<div class="flexslider">。然后,创建一个<ul class=”slides”>。重要的是要使用这个类,因为滑块专门针对该类。将您的图像和其他任何你希望添加应用到幻灯片的内容 添加到<li>中..........

例如:

<!-- 示例 添加到<body>或者你的页面位置 -->
<div class="flexslider">
  <ul class="slides">
    <li>
      <img src="slide1.jpg" />
    </li>
    <li>
      <img src="slide2.jpg" />
    </li>
    <li>
      <img src="slide3.jpg" />
    </li>
  </ul>
</div>

最后,添加以下几行的Javascript到您的文档<HEAD>,从步骤1开始下面的链接。 $(window).load(),以确保在内容页面加载插件初始化之前。也就是在<HEAD>最开始的位置加载js

<!-- 包含在 <head>标签中, 并进行初始化 -->
<script type="text/javascript" charset="utf-8">
  $(window).load(function() {
    $('.flexslider').flexslider();
  });
</script>

看,已经包最基本的的FlexSlider安装到您的网页 下面开始定义你的幻灯片吧!

 

下面是添加参数:

if(jQuery().flexslider)
    {

        // Flex 幻灯参数配置
		$('.flexslider').flexslider({
							animation: "fade",
          slideshowSpeed: 7000,//设置幻灯片循环的速度,单位为毫秒
          animationSpeed: 1500,//设置动画的速度,单位为毫秒							directionNav: true,
							controlNav: false,
							keyboardNav: true
						});

 

下面是参数:可以复制到google翻译查看 注释

namespace: "flex-",              / / {NEW}字符串:连接到由插件生成的每一个元素类的前缀字符串 every element generated by the plugin
selector: ".slides > li",       //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
animation: "fade",              //String: Select your animation type, "fade" or "slide"
easing: "swing",               //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
direction: "horizontal",        //String: Select the sliding direction, "horizontal" or "vertical"
reverse: false,                 //{NEW} Boolean: Reverse the animation direction
animationLoop: true,             //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
smoothHeight: false,            //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
slideshow: true,                //Boolean: Animate slider automatically
slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
animationSpeed: 600,            //Integer: Set the speed of animations, in milliseconds
initDelay: 0,                   //{NEW} Integer: Set an initialization delay, in milliseconds
randomize: false,               //Boolean: Randomize slide order

// Usability features
pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
touch: true,                    //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
video: false,                   //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches

// Primary Controls
controlNav: true,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
directionNav viagra for sale without a prescription: true,             //Boolean: Create navigation for previous/next navigation? (true/false)
prevText: "Previous",           //String: Set the text for the "previous" directionNav item
nextText: "Next",               //String: Set the text for the "next" directionNav item

// Secondary Navigation
keyboard: true,                 //Boolean: Allow slider navigating via keyboard left/right keys
multipleKeyboard: false,        //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
mousewheel: false,              //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
pausePlay: false,               //Boolean: Create pause/play dynamic element
pauseText: 'Pause',             //String: Set the text for the "pause" pausePlay item
playText: 'Play',               //String: Set the text for the "play" pausePlay item

// Special properties
controlsContainer: "",          //{UPDATED} Selector: USE CLASS SELECTOR. Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be ".flexslider-container". Property is ignored if given element is not found.
manualControls: "",             //Selector: Declare custom control navigation. Examples would be ".flex-control-nav li" or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
sync: "",                       //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
asNavFor: "",                   //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider

// Carousel Options
itemWidth: 0,                   //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
itemMargin: 0,                  //{NEW} Integer: Margin between carousel items.
minItems: 0,                    //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
maxItems: 0,                    //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
move: 0,                        //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.

// Callback API
start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide
before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation
after: function(){},            //Callback: function(slider) - Fires after each slider animation completes
end: function(){},              //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
added: function(){},            //{NEW} Callback: function(slider) - Fires after a slide is added
removed: function(){}           //{NEW} Callback: function(slider) - Fires after a slide is removed