前言体朋几一级发等点确层数框的很屏果行4带域:这个效果是在某个视频中看到的,效果还可以,直分调浏器代,刚求的一学础过功互有解小久宗点差维含数如数围请就保存下来了
二话不说,先遇新是直朋能到分览上代码
js的代码如遇新是直朋能到下
/*!
* PageSwitch 1.0
*
*/
(function($){
"use strict";
/*说明:获取浏览器前缀*/
/*实现:判断某个元素的css样式中是否存在transition属性*/
/*参数:dom元素*/
/*返回值:boolean,有则返回浏览器样式前缀,否则返回false*/
var _prefix = (function(temp){
var aPrefix = ["webkit", "Moz", "o", "ms"],
props = "";
for(var i in aPrefix){
props = aPrefix[i] + "Transition";
if(temp.style[ props ] !== undefined){
return "-"+aPrefix[i].toLowerCase()+"-";
}
}
return false;
})(document.createElement(PageSwitch));
var PageSwitch = (function(){
function PageSwitch(element, options){
this.settings = $.extend(true, $.fn.PageSwitch.defaults, options||{});
this.element = element;
this.init();
}
PageSwitch.prototype = {
/*说明:初始化插件*/
/*实现:初始化dom结构,布局,分页及绑定事件*/
init : function(){
var me = this;
me.selectors = me.settings.selectors;
me.sections = me.element.find(me.selectors.sections);
me.section = me.sections.find(me.selectors.section);
me.direction = me.settings.direction == "vertical" ? true : false;
me.pagesCount = me.pagesCount();
me.index = (me.settings.index >= 0 && me.settings.index < me.pagesCount) ? me.settings.index : 0;
me.canscroll = true;
if(!me.direction || me.index){
me._initLayout();
}
if(me.settings.pagination){
me._initPaging();
}
me._initEvent();
},
/*说明:获取滑动页面数量*/
pagesCount : function(){
return this.section.length;
},
/*说明:获取滑动的宽度(横屏滑动)或高度(竖屏滑动)*/
switchLength : function(){
return this.direction == 1 ? this.element.height() : t