From 870bc2f0363150697682a324d15272bf8680e352 Mon Sep 17 00:00:00 2001 From: xieyu33333 Date: Wed, 9 Sep 2015 02:30:44 +0800 Subject: [PATCH 01/18] initPlugin when loadData --- README_Chinese.md | 5 +++++ build/iSlider.js | 4 +++- build/iSlider.min.js | 2 +- demo/public/js/iSlider.js | 4 +++- src/js/iSlider.js | 4 +++- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README_Chinese.md b/README_Chinese.md index 8900c335..4570cfb1 100755 --- a/README_Chinese.md +++ b/README_Chinese.md @@ -239,6 +239,11 @@ var data = [{ {number} 默认首屏所使用的数据列表索引 + + fixPage + {boolean} + 是否禁用垂直滚动和回弹效果,默认:true(开启) + plugins {array} diff --git a/build/iSlider.js b/build/iSlider.js index 3263fa73..f9b3511a 100644 --- a/build/iSlider.js +++ b/build/iSlider.js @@ -852,7 +852,8 @@ iSliderPrototype.startHandler = function (evt) { if (this.fixPage) { var target = evt.target; - if (target.tagName !== 'SELECT' && target.tagName !== 'INPUT' && target.tagName !== 'TEXTAREA') { + var whiteList = ['SELECT', 'INPUT', 'TEXTAREA', 'BUTTON', 'LABEL']; + if (whiteList.indexOf(target.tagName) < 0) { evt.preventDefault(); } } @@ -1267,6 +1268,7 @@ this.slideIndex = initIndex || 0; this.data = data; this._renderHTML(); + this._initPlugins(); this.isAutoplay && this.play(); }; diff --git a/build/iSlider.min.js b/build/iSlider.min.js index c908e9c9..f6105dbc 100644 --- a/build/iSlider.min.js +++ b/build/iSlider.min.js @@ -1 +1 @@ -!function(t){"use strict";function i(t,i){return i.indexOf(t)>-1}function e(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t,i){return t.className.match(new RegExp("(\\s|^)"+i+"(\\s|$)"))}function n(t,i){s(t,i)||(t.className+=" "+i)}function a(t,i){s(t,i)&&(t.className=t.className.replace(RegExp("(\\s|^)"+i+"(\\s|$)"),""))}function h(t){if(/<\/?[^>]*>/g.test(t))return!1;var i="^(((https|http|ftp|rtsp|mms):)?//)?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})?(:[0-9]{1,4})?([^?#]+)?(\\?[^#]+)?(#.+)?$";return new RegExp(i).test(t)}var r=function(t){if(!t.dom)throw new Error("Container can not be empty!");if(!t.data||!t.data.length)throw new Error("Data must be an array and must have more than one element!");this._opts=t,this._setting(),this._renderHTML(),this._initPlugins(),this._bindHandler()};r.EVENTS="slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored destroy".split(" "),r.EASING=["linear ease ease-in ease-out ease-in-out".split(" "),/cubic-bezier\(([^\d]*(\d+.?\d*)[^\,]*\,?){4}\)/],r.EMPTY_FUNCTION=function(){},r.extend=function(){if(arguments.length){var t,i;switch(arguments.length){case 1:t=r.prototype,i=arguments[0];break;case 2:t=arguments[0],i=arguments[1]}for(var e in i)i.hasOwnProperty(e)&&(t[e]=i[e])}},r.plugins={},r.regPlugin=function(t,i){r.plugins[t]=r.plugins[t]||i},r._animateFuncs={"default":function(t,i,e,s,n){t.style.webkitTransform="translateZ(0) translate"+i+"("+(n+e*(s-1))+"px)"}},r._transitionEndEvent=function(){var t;return function(){if(t)return t;var i=document.createElement("fakeElement"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(var s in e)if(e.hasOwnProperty(s)&&void 0!==i.style[s])return t=e[s]}}();var o=r.prototype;o.extend=r.extend,o._setting=function(){this._plugins=r.plugins,this._animateFuncs=r._animateFuncs,this.holding=!1,this.locking=!1;var s=this._opts;this.wrap=s.dom,this.data=s.data,this.type=s.type||null,this.isVertical=s.isVertical||!1,this.isOverspread=s.isOverspread||!1,this.duration=s.duration||2e3,this.initIndex=s.initIndex||0,this.fixPage=void 0===s.fixPage?!0:s.fixPage,(this.initIndex>this.data.length-1||this.initIndex<0)&&(this.initIndex=0),this.slideIndex=this.slideIndex||this.initIndex||0,this.axis=this.isVertical?"Y":"X",this.reverseAxis="Y"===this.axis?"X":"Y",this.width=this.wrap.clientWidth,this.height=this.wrap.clientHeight,this.ratio=this.height/this.width,this.scale=this.isVertical?this.height:this.width,this.isLoading=s.isLoading,this.offset=this.offset||{X:0,Y:0},this.data.length<2?(this.isLooping=!1,this.isAutoPlay=!1):(this.isLooping=s.isLooping||!1,this.isAutoplay=s.isAutoplay||!1),"card"===s.animateType&&this.isVertical&&(this.isOverspread=!0),this.log=s.isDebug?function(){t.console.log.apply(t.console,arguments)}:r.EMPTY_FUNCTION,this._setUpDamping(),this._animateFunc=this._animateFuncs[s.animateType in this._animateFuncs?s.animateType:"default"],this.animateTime=null!=s.animateTime&&s.animateTime>-1?s.animateTime:300,this.animateEasing=i(s.animateEasing,r.EASING[0])||r.EASING[1].test(s.animateEasing)?s.animateEasing:"ease",this.inAnimate=0,this.deviceEvents=function(){var i=!!("ontouchstart"in t||t.DocumentTouch&&document instanceof t.DocumentTouch);return{hasTouch:i,startEvt:i?"touchstart":"mousedown",moveEvt:i?"touchmove":"mousemove",endEvt:i?"touchend":"mouseup"}}(),this.events={},this.on("slide",s.onslide),this.on("slideStart",s.onslidestart),this.on("slideEnd",s.onslideend),this.on("slideChange",s.onslidechange),this.on("slideChanged",s.onslidechanged),this.on("slideRestore",s.onsliderestore),this.on("slideRestored",s.onsliderestored),this.pluginConfig=function(){if(e(s.plugins)){var t={};return s.plugins.forEach(function(i){e(i)?t[i[0]]=i.slice(1):"string"==typeof i&&(t[i]=[])}),t}return{}}(),this.isAutoplay&&this.play()},o._initPlugins=function(){var t=this.pluginConfig,i=this._plugins;for(var e in t)t.hasOwnProperty(e)&&i.hasOwnProperty(e)&&(this.log("[INIT PLUGIN]:",e,i[e]),i[e]&&"function"==typeof i[e]&&typeof i[e].apply&&i[e].apply(this,t[e]))},o._setUpDamping=function(){var t=this.scale>>1,i=t>>1,e=i>>2;this._damping=function(s){var n,a=Math.abs(s);return n=t>a?a>>1:t+i>a?i+(a-t>>2):i+e+(a-t-i>>3),s>0?n:-n}},o._itemType=function(t){var i=this.data[t].content;return null==i?"empty":Boolean(i.nodeName)&&Boolean(i.nodeType)?"node":"string"==typeof i?h(i)?"pic":"html":"unknown"},o._renderItem=function(t,i){var e,s,n=this.data.length,a=function(){s=e.height/e.width>this.ratio?'':'',t.innerHTML=s}.bind(this);if(t.innerHTML="",t.style.background="",this.isLooping||null!=this.data[i]){i=(n+i)%n,e=this.data[i];var h=null!=this.type?this.type:e.type||(e.type=this._itemType(i));switch(this.log("[Render ITEM]:",h,i,e),t.className="islider-"+h,h){case"pic":if(this.isOverspread)t.style.background="url("+e.content+") no-repeat 50% 50%/cover";else if(e.height&&e.width)a();else{var r=new Image;r.src=e.content,r.onload=function(){e.height=r.height,e.width=r.width,a()}}break;case"dom":case"html":t.innerHTML=e.content;break;case"node":case"element":if(11===e.content.nodeType){var o=document.createElement("div");o.appendChild(e.content),e.content=o}t.appendChild(e.content)}}},o._renderIntermediateScene=function(){null!=this._intermediateScene&&(this._renderItem.apply(this,this._intermediateScene),this._intermediateScene=null)},o._changedStyles=function(){var t=["islider-prev","islider-active","islider-next"];this.els.forEach(function(i,e){a(i,"("+t.join("|")+")"),n(i,t[e])})},o._renderHTML=function(){this.outer&&(this.outer.innerHTML="");var t=this.outer||document.createElement("ul");if(t.className="islider-outer",t.style.cssText="height:"+this.height+"px;width:"+this.width+"px;margin:0;padding:0;list-style:none;","pic"===this.type&&!this.loader&&this.isLoading){var i=document.createElement("div");i.className="islider-loader",this.loader=i,this.wrap.appendChild(i)}this.els=[];for(var e=0;3>e;e++){var s=document.createElement("li");s.style.cssText="height:"+this.height+"px;width:"+this.width+"px;",this.els.push(s),this._animateFunc(s,this.axis,this.scale,e,0),!this.isVertical||"rotate"!==this._opts.animateType&&"flip"!==this._opts.animateType?this._renderItem(s,e-1+this.slideIndex):this._renderItem(s,1-e+this.slideIndex),t.appendChild(s)}this._changedStyles(),this._initLoadImg(),this.outer||(this.outer=t,this.wrap.appendChild(t))},o._preloadImg=function(t){if("pic"===this.type&&this.data.length>3){var i=this.data,e=i.length,s=function(t){if(t>-1&&"pic"===i[t].type&&!i[t].loaded){var e=new Image;e.src=i[t].content,e.onload=function(){i[t].width=e.width,i[t].height=e.height},i[t].loaded=1}};s(t+2>e-1?(t+2)%e:t+2),s(0>t-2?e-2+t:t-2)}},o._initLoadImg=function(){var t=this.data,i=t.length,e=this.slideIndex,s=this;if("pic"===this.type&&i>3){var n=e+2>i?(e+1)%i:e+1,a=0>e-1?i-1+e:e-1;t[e].loaded=1,t[n].loaded=1,s.isLooping&&(t[a].loaded=1),setTimeout(function(){s._preloadImg(e)},200)}},o._watchTransitionEnd=function(i,e){function s(){a&&t.clearTimeout(a),h.inAnimate--,h.log("Event:","watchTransitionEnd::stuck::release",h.inAnimate),0===h.inAnimate&&("slideChanged"===e&&h._changedStyles(),h.fire.apply(h,o),h._renderIntermediateScene()),n()}function n(){h.els.forEach(function(t){t.removeEventListener(r._transitionEndEvent(),s)}),h.isAnimating=!1}var a,h=this,o=Array.prototype.slice.call(arguments,1);this.log("Event:","watchTransitionEnd::stuck::pile",this.inAnimate),i>0&&h.els.forEach(function(t){t.addEventListener(r._transitionEndEvent(),s)}),a=t.setTimeout(s,i),h.inAnimate++},o._bindHandler=function(){var i=this.outer,e=this.deviceEvents;e.hasTouch||(i.style.cursor="pointer",i.ondragstart=function(t){return t?!1:!0}),i.addEventListener(e.startEvt,this),i.addEventListener(e.moveEvt,this),i.addEventListener(e.endEvt,this),t.addEventListener("orientationchange",this),t.addEventListener("focus",this,!1),t.addEventListener("blur",this,!1)},o.handleEvent=function(t){var i=this.deviceEvents;switch(t.type){case i.startEvt:this.startHandler(t);break;case i.moveEvt:this.moveHandler(t);break;case i.endEvt:this.endHandler(t);break;case"touchcancel":this.endHandler(t);break;case"orientationchange":this.orientationchangeHandler();break;case"focus":this.isAutoplay&&this.play();break;case"blur":this.pause()}},o.startHandler=function(t){if(this.fixPage){var i=t.target;"SELECT"!==i.tagName&&"INPUT"!==i.tagName&&"TEXTAREA"!==i.tagName&&t.preventDefault()}if(!this.holding&&!this.locking){var e=this.deviceEvents;this.isMoving=!0,this.pause(),this.log("Event: start"),this.fire("slideStart",t,this),this.startTime=(new Date).getTime(),this.startX=e.hasTouch?t.targetTouches[0].pageX:t.pageX,this.startY=e.hasTouch?t.targetTouches[0].pageY:t.pageY}},o.moveHandler=function(t){if(this.isMoving){this.log("Event: moving");var i=this.deviceEvents,e=this.data.length,s=this.axis,n=this.reverseAxis,a={X:i.hasTouch?t.targetTouches[0].pageX-this.startX:t.pageX-this.startX,Y:i.hasTouch?t.targetTouches[0].pageY-this.startY:t.pageY-this.startY};if(this.offset=a,Math.abs(a[s])-Math.abs(a[n])>10){t.preventDefault(),this.fire("slide",t,this),this.isLooping||(a[s]>0&&0===this.slideIndex||a[s]<0&&this.slideIndex===e-1)&&(a[s]=this._damping(a[s]));for(var h=0;3>h;h++){var r=this.els[h];r.style.webkitTransition="all 0s",this._animateFunc(r,s,this.scale,h,a[s])}}}},o.endHandler=function(i){if(this.isMoving){this.log("Event: end"),this.isMoving=!1;var e=this.offset,s=this.axis,n=this.scale/2,a=(new Date).getTime();n=a-this.startTime>300?n:14;var h=Math.abs(e[s]),r=Math.abs(e[this.reverseAxis]),o=function(i){if("A"===i.tagName){if(i.href)return t.location.href=i.href,!1}else{if("islider-pic"!==i.className)return!1;o(i.parentNode)}};this.log(n,e[s],h,r,this),this.slideTo(e[s]>=n&&h>r?this.slideIndex-1:e[s]<-n&&h>r?this.slideIndex+1:this.slideIndex),Math.abs(this.offset.X)<10&&Math.abs(this.offset.Y)<10&&(this.tapEvt=document.createEvent("Event"),this.tapEvt.initEvent("tap",!0,!0),this.fixPage&&i.target&&o(i.target),i.target.dispatchEvent(this.tapEvt)||i.preventDefault()),this.offset.X=this.offset.Y=0,this.isAutoplay&&this.play(),this.fire("slideEnd",i,this)}},o.orientationchangeHandler=function(){setTimeout(function(){this.reset(),this.log("Event: orientationchange")}.bind(this),100)},o.slideTo=function(t,i){if(!this.locking){this.unhold();var e,s=this.animateTime,n=this._opts.animateType,a=this._animateFunc,h=this.data,r=this.els,o=t,l=t-this.slideIndex,d=this.offset;"object"==typeof i&&(i.animateTime>-1&&(s=i.animateTime),"string"==typeof i.animateType&&i.animateType in this._animateFuncs&&(n=i.animateType,a=this._animateFuncs[n]));var c=Math.abs(d[this.axis])/this.scale*s;Math.abs(l)>1&&this._renderItem(l>0?this.els[2]:this.els[0],o),this._preloadImg(o),h[o]?this.slideIndex=o:this.isLooping?this.slideIndex=l>0?0:h.length-1:(this.slideIndex=this.slideIndex,l=0),this.log("Index:"+this.slideIndex);var u,p;if(0===l)e="slideRestore";else{var f=(this.isVertical&&("rotate"===n||"flip"===n))^l>0;f?(r.push(r.shift()),u=r[2],p=r[0]):(r.unshift(r.pop()),u=r[0],p=r[2]),1===Math.abs(l)?(this._renderIntermediateScene(),this._renderItem(u,o+l)):Math.abs(l)>1&&(this._renderItem(u,o+(f?1:-1)),this._intermediateScene=[p,o+(f?-1:1)]),u.style.webkitTransition="none",u.style.visibility="hidden",setTimeout(function(){u.style.visibility="visible"},200),c=s-c,e="slideChange"}this.fire(e,this.slideIndex,r[1],this),this._watchTransitionEnd(c,e+"d",this.slideIndex,r[1],this);for(var g=0;3>g;g++)r[g]!==u&&(r[g].style.webkitTransition="all "+c/1e3+"s "+this.animateEasing),a.call(this,r[g],this.axis,this.scale,g,0);this.isAutoplay&&!this.isLooping&&this.slideIndex===h.length-1&&this.pause()}},o.slideNext=function(){this.slideTo.apply(this,[this.slideIndex+1].concat(Array.prototype.slice.call(arguments)))},o.slidePrev=function(){this.slideTo.apply(this,[this.slideIndex-1].concat(Array.prototype.slice.call(arguments)))},o.regPlugin=function(){var t=Array.prototype.slice.call(arguments),e=t.shift(),s=t[0];(this._plugins.hasOwnProperty(e)||"function"==typeof s)&&("function"==typeof s&&(this._plugins[e]=s,t.shift()),i(e,this._opts.plugins)||(this._opts.plugins.push(t.length?[].concat([e],t):e),"function"==typeof this._plugins[e]&&this._plugins[e].apply(this,t)))},o.bind=o.delegate=function(i,e,s){function n(i){for(var n=t.event?t.event:i,a=n.target,h=document.querySelectorAll(e),r=0;r-1&&delete e[s]}},o.fire=function(t){if(this.log("[EVENT FIRE]:",t,arguments),t in this.events)for(var i=this.events[t],e=0;e-1}function e(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t,i){return t.className.match(new RegExp("(\\s|^)"+i+"(\\s|$)"))}function n(t,i){s(t,i)||(t.className+=" "+i)}function a(t,i){s(t,i)&&(t.className=t.className.replace(RegExp("(\\s|^)"+i+"(\\s|$)"),""))}function h(t){if(/<\/?[^>]*>/g.test(t))return!1;var i="^(((https|http|ftp|rtsp|mms):)?//)?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})?(:[0-9]{1,4})?([^?#]+)?(\\?[^#]+)?(#.+)?$";return new RegExp(i).test(t)}var r=function(t){if(!t.dom)throw new Error("Container can not be empty!");if(!t.data||!t.data.length)throw new Error("Data must be an array and must have more than one element!");this._opts=t,this._setting(),this._renderHTML(),this._initPlugins(),this._bindHandler()};r.EVENTS="slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored destroy".split(" "),r.EASING=["linear ease ease-in ease-out ease-in-out".split(" "),/cubic-bezier\(([^\d]*(\d+.?\d*)[^\,]*\,?){4}\)/],r.EMPTY_FUNCTION=function(){},r.extend=function(){if(arguments.length){var t,i;switch(arguments.length){case 1:t=r.prototype,i=arguments[0];break;case 2:t=arguments[0],i=arguments[1]}for(var e in i)i.hasOwnProperty(e)&&(t[e]=i[e])}},r.plugins={},r.regPlugin=function(t,i){r.plugins[t]=r.plugins[t]||i},r._animateFuncs={"default":function(t,i,e,s,n){t.style.webkitTransform="translateZ(0) translate"+i+"("+(n+e*(s-1))+"px)"}},r._transitionEndEvent=function(){var t;return function(){if(t)return t;var i=document.createElement("fakeElement"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(var s in e)if(e.hasOwnProperty(s)&&void 0!==i.style[s])return t=e[s]}}();var o=r.prototype;o.extend=r.extend,o._setting=function(){this._plugins=r.plugins,this._animateFuncs=r._animateFuncs,this.holding=!1,this.locking=!1;var s=this._opts;this.wrap=s.dom,this.data=s.data,this.type=s.type||null,this.isVertical=s.isVertical||!1,this.isOverspread=s.isOverspread||!1,this.duration=s.duration||2e3,this.initIndex=s.initIndex||0,this.fixPage=void 0===s.fixPage?!0:s.fixPage,(this.initIndex>this.data.length-1||this.initIndex<0)&&(this.initIndex=0),this.slideIndex=this.slideIndex||this.initIndex||0,this.axis=this.isVertical?"Y":"X",this.reverseAxis="Y"===this.axis?"X":"Y",this.width=this.wrap.clientWidth,this.height=this.wrap.clientHeight,this.ratio=this.height/this.width,this.scale=this.isVertical?this.height:this.width,this.isLoading=s.isLoading,this.offset=this.offset||{X:0,Y:0},this.data.length<2?(this.isLooping=!1,this.isAutoPlay=!1):(this.isLooping=s.isLooping||!1,this.isAutoplay=s.isAutoplay||!1),"card"===s.animateType&&this.isVertical&&(this.isOverspread=!0),this.log=s.isDebug?function(){t.console.log.apply(t.console,arguments)}:r.EMPTY_FUNCTION,this._setUpDamping(),this._animateFunc=this._animateFuncs[s.animateType in this._animateFuncs?s.animateType:"default"],this.animateTime=null!=s.animateTime&&s.animateTime>-1?s.animateTime:300,this.animateEasing=i(s.animateEasing,r.EASING[0])||r.EASING[1].test(s.animateEasing)?s.animateEasing:"ease",this.inAnimate=0,this.deviceEvents=function(){var i=!!("ontouchstart"in t||t.DocumentTouch&&document instanceof t.DocumentTouch);return{hasTouch:i,startEvt:i?"touchstart":"mousedown",moveEvt:i?"touchmove":"mousemove",endEvt:i?"touchend":"mouseup"}}(),this.events={},this.on("slide",s.onslide),this.on("slideStart",s.onslidestart),this.on("slideEnd",s.onslideend),this.on("slideChange",s.onslidechange),this.on("slideChanged",s.onslidechanged),this.on("slideRestore",s.onsliderestore),this.on("slideRestored",s.onsliderestored),this.pluginConfig=function(){if(e(s.plugins)){var t={};return s.plugins.forEach(function(i){e(i)?t[i[0]]=i.slice(1):"string"==typeof i&&(t[i]=[])}),t}return{}}(),this.isAutoplay&&this.play()},o._initPlugins=function(){var t=this.pluginConfig,i=this._plugins;for(var e in t)t.hasOwnProperty(e)&&i.hasOwnProperty(e)&&(this.log("[INIT PLUGIN]:",e,i[e]),i[e]&&"function"==typeof i[e]&&typeof i[e].apply&&i[e].apply(this,t[e]))},o._setUpDamping=function(){var t=this.scale>>1,i=t>>1,e=i>>2;this._damping=function(s){var n,a=Math.abs(s);return n=t>a?a>>1:t+i>a?i+(a-t>>2):i+e+(a-t-i>>3),s>0?n:-n}},o._itemType=function(t){var i=this.data[t].content;return null==i?"empty":Boolean(i.nodeName)&&Boolean(i.nodeType)?"node":"string"==typeof i?h(i)?"pic":"html":"unknown"},o._renderItem=function(t,i){var e,s,n=this.data.length,a=function(){s=e.height/e.width>this.ratio?'':'',t.innerHTML=s}.bind(this);if(t.innerHTML="",t.style.background="",this.isLooping||null!=this.data[i]){i=(n+i)%n,e=this.data[i];var h=null!=this.type?this.type:e.type||(e.type=this._itemType(i));switch(this.log("[Render ITEM]:",h,i,e),t.className="islider-"+h,h){case"pic":if(this.isOverspread)t.style.background="url("+e.content+") no-repeat 50% 50%/cover";else if(e.height&&e.width)a();else{var r=new Image;r.src=e.content,r.onload=function(){e.height=r.height,e.width=r.width,a()}}break;case"dom":case"html":t.innerHTML=e.content;break;case"node":case"element":if(11===e.content.nodeType){var o=document.createElement("div");o.appendChild(e.content),e.content=o}t.appendChild(e.content)}}},o._renderIntermediateScene=function(){null!=this._intermediateScene&&(this._renderItem.apply(this,this._intermediateScene),this._intermediateScene=null)},o._changedStyles=function(){var t=["islider-prev","islider-active","islider-next"];this.els.forEach(function(i,e){a(i,"("+t.join("|")+")"),n(i,t[e])})},o._renderHTML=function(){this.outer&&(this.outer.innerHTML="");var t=this.outer||document.createElement("ul");if(t.className="islider-outer",t.style.cssText="height:"+this.height+"px;width:"+this.width+"px;margin:0;padding:0;list-style:none;","pic"===this.type&&!this.loader&&this.isLoading){var i=document.createElement("div");i.className="islider-loader",this.loader=i,this.wrap.appendChild(i)}this.els=[];for(var e=0;3>e;e++){var s=document.createElement("li");s.style.cssText="height:"+this.height+"px;width:"+this.width+"px;",this.els.push(s),this._animateFunc(s,this.axis,this.scale,e,0),!this.isVertical||"rotate"!==this._opts.animateType&&"flip"!==this._opts.animateType?this._renderItem(s,e-1+this.slideIndex):this._renderItem(s,1-e+this.slideIndex),t.appendChild(s)}this._changedStyles(),this._initLoadImg(),this.outer||(this.outer=t,this.wrap.appendChild(t))},o._preloadImg=function(t){if("pic"===this.type&&this.data.length>3){var i=this.data,e=i.length,s=function(t){if(t>-1&&"pic"===i[t].type&&!i[t].loaded){var e=new Image;e.src=i[t].content,e.onload=function(){i[t].width=e.width,i[t].height=e.height},i[t].loaded=1}};s(t+2>e-1?(t+2)%e:t+2),s(0>t-2?e-2+t:t-2)}},o._initLoadImg=function(){var t=this.data,i=t.length,e=this.slideIndex,s=this;if("pic"===this.type&&i>3){var n=e+2>i?(e+1)%i:e+1,a=0>e-1?i-1+e:e-1;t[e].loaded=1,t[n].loaded=1,s.isLooping&&(t[a].loaded=1),setTimeout(function(){s._preloadImg(e)},200)}},o._watchTransitionEnd=function(i,e){function s(){a&&t.clearTimeout(a),h.inAnimate--,h.log("Event:","watchTransitionEnd::stuck::release",h.inAnimate),0===h.inAnimate&&("slideChanged"===e&&h._changedStyles(),h.fire.apply(h,o),h._renderIntermediateScene()),n()}function n(){h.els.forEach(function(t){t.removeEventListener(r._transitionEndEvent(),s)}),h.isAnimating=!1}var a,h=this,o=Array.prototype.slice.call(arguments,1);this.log("Event:","watchTransitionEnd::stuck::pile",this.inAnimate),i>0&&h.els.forEach(function(t){t.addEventListener(r._transitionEndEvent(),s)}),a=t.setTimeout(s,i),h.inAnimate++},o._bindHandler=function(){var i=this.outer,e=this.deviceEvents;e.hasTouch||(i.style.cursor="pointer",i.ondragstart=function(t){return t?!1:!0}),i.addEventListener(e.startEvt,this),i.addEventListener(e.moveEvt,this),i.addEventListener(e.endEvt,this),t.addEventListener("orientationchange",this),t.addEventListener("focus",this,!1),t.addEventListener("blur",this,!1)},o.handleEvent=function(t){var i=this.deviceEvents;switch(t.type){case i.startEvt:this.startHandler(t);break;case i.moveEvt:this.moveHandler(t);break;case i.endEvt:this.endHandler(t);break;case"touchcancel":this.endHandler(t);break;case"orientationchange":this.orientationchangeHandler();break;case"focus":this.isAutoplay&&this.play();break;case"blur":this.pause()}},o.startHandler=function(t){if(this.fixPage){var i=t.target,e=["SELECT","INPUT","TEXTAREA","BUTTON","LABEL"];e.indexOf(i.tagName)<0&&t.preventDefault()}if(!this.holding&&!this.locking){var s=this.deviceEvents;this.isMoving=!0,this.pause(),this.log("Event: start"),this.fire("slideStart",t,this),this.startTime=(new Date).getTime(),this.startX=s.hasTouch?t.targetTouches[0].pageX:t.pageX,this.startY=s.hasTouch?t.targetTouches[0].pageY:t.pageY}},o.moveHandler=function(t){if(this.isMoving){this.log("Event: moving");var i=this.deviceEvents,e=this.data.length,s=this.axis,n=this.reverseAxis,a={X:i.hasTouch?t.targetTouches[0].pageX-this.startX:t.pageX-this.startX,Y:i.hasTouch?t.targetTouches[0].pageY-this.startY:t.pageY-this.startY};if(this.offset=a,Math.abs(a[s])-Math.abs(a[n])>10){t.preventDefault(),this.fire("slide",t,this),this.isLooping||(a[s]>0&&0===this.slideIndex||a[s]<0&&this.slideIndex===e-1)&&(a[s]=this._damping(a[s]));for(var h=0;3>h;h++){var r=this.els[h];r.style.webkitTransition="all 0s",this._animateFunc(r,s,this.scale,h,a[s])}}}},o.endHandler=function(i){if(this.isMoving){this.log("Event: end"),this.isMoving=!1;var e=this.offset,s=this.axis,n=this.scale/2,a=(new Date).getTime();n=a-this.startTime>300?n:14;var h=Math.abs(e[s]),r=Math.abs(e[this.reverseAxis]),o=function(i){if("A"===i.tagName){if(i.href)return t.location.href=i.href,!1}else{if("islider-pic"!==i.className)return!1;o(i.parentNode)}};this.log(n,e[s],h,r,this),this.slideTo(e[s]>=n&&h>r?this.slideIndex-1:e[s]<-n&&h>r?this.slideIndex+1:this.slideIndex),Math.abs(this.offset.X)<10&&Math.abs(this.offset.Y)<10&&(this.tapEvt=document.createEvent("Event"),this.tapEvt.initEvent("tap",!0,!0),this.fixPage&&i.target&&o(i.target),i.target.dispatchEvent(this.tapEvt)||i.preventDefault()),this.offset.X=this.offset.Y=0,this.isAutoplay&&this.play(),this.fire("slideEnd",i,this)}},o.orientationchangeHandler=function(){setTimeout(function(){this.reset(),this.log("Event: orientationchange")}.bind(this),100)},o.slideTo=function(t,i){if(!this.locking){this.unhold();var e,s=this.animateTime,n=this._opts.animateType,a=this._animateFunc,h=this.data,r=this.els,o=t,l=t-this.slideIndex,d=this.offset;"object"==typeof i&&(i.animateTime>-1&&(s=i.animateTime),"string"==typeof i.animateType&&i.animateType in this._animateFuncs&&(n=i.animateType,a=this._animateFuncs[n]));var c=Math.abs(d[this.axis])/this.scale*s;Math.abs(l)>1&&this._renderItem(l>0?this.els[2]:this.els[0],o),this._preloadImg(o),h[o]?this.slideIndex=o:this.isLooping?this.slideIndex=l>0?0:h.length-1:(this.slideIndex=this.slideIndex,l=0),this.log("Index:"+this.slideIndex);var u,p;if(0===l)e="slideRestore";else{var f=(this.isVertical&&("rotate"===n||"flip"===n))^l>0;f?(r.push(r.shift()),u=r[2],p=r[0]):(r.unshift(r.pop()),u=r[0],p=r[2]),1===Math.abs(l)?(this._renderIntermediateScene(),this._renderItem(u,o+l)):Math.abs(l)>1&&(this._renderItem(u,o+(f?1:-1)),this._intermediateScene=[p,o+(f?-1:1)]),u.style.webkitTransition="none",u.style.visibility="hidden",setTimeout(function(){u.style.visibility="visible"},200),c=s-c,e="slideChange"}this.fire(e,this.slideIndex,r[1],this),this._watchTransitionEnd(c,e+"d",this.slideIndex,r[1],this);for(var g=0;3>g;g++)r[g]!==u&&(r[g].style.webkitTransition="all "+c/1e3+"s "+this.animateEasing),a.call(this,r[g],this.axis,this.scale,g,0);this.isAutoplay&&!this.isLooping&&this.slideIndex===h.length-1&&this.pause()}},o.slideNext=function(){this.slideTo.apply(this,[this.slideIndex+1].concat(Array.prototype.slice.call(arguments)))},o.slidePrev=function(){this.slideTo.apply(this,[this.slideIndex-1].concat(Array.prototype.slice.call(arguments)))},o.regPlugin=function(){var t=Array.prototype.slice.call(arguments),e=t.shift(),s=t[0];(this._plugins.hasOwnProperty(e)||"function"==typeof s)&&("function"==typeof s&&(this._plugins[e]=s,t.shift()),i(e,this._opts.plugins)||(this._opts.plugins.push(t.length?[].concat([e],t):e),"function"==typeof this._plugins[e]&&this._plugins[e].apply(this,t)))},o.bind=o.delegate=function(i,e,s){function n(i){for(var n=t.event?t.event:i,a=n.target,h=document.querySelectorAll(e),r=0;r-1&&delete e[s]}},o.fire=function(t){if(this.log("[EVENT FIRE]:",t,arguments),t in this.events)for(var i=this.events[t],e=0;e Date: Wed, 9 Sep 2015 11:28:43 +0800 Subject: [PATCH 02/18] Modified plugin init when loadData, and will fire event "reloadData" --- README.md | 6 ++++++ README_Chinese.md | 6 ++++++ src/js/iSlider.js | 4 ++-- src/js/plugins/dot.js | 40 ++++++++++++++++++++++++++-------------- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 1a3ab9db..93def5f4 100755 --- a/README.md +++ b/README.md @@ -443,6 +443,12 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE
  • slideRestored
  • +
  • + reloadData +
  • +
  • + destroy +
  • diff --git a/README_Chinese.md b/README_Chinese.md index 4570cfb1..e52229a0 100755 --- a/README_Chinese.md +++ b/README_Chinese.md @@ -439,6 +439,12 @@ var data = [{
  • slideRestored
  • +
  • + reloadData +
  • +
  • + destroy +
  • diff --git a/src/js/iSlider.js b/src/js/iSlider.js index f9b3511a..f252527b 100644 --- a/src/js/iSlider.js +++ b/src/js/iSlider.js @@ -136,7 +136,7 @@ * @type {Array} * @protected */ - iSlider.EVENTS = 'slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored destroy'.split(' '); + iSlider.EVENTS = 'slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored reloadData destroy'.split(' '); /** * Easing white list @@ -1268,7 +1268,7 @@ this.slideIndex = initIndex || 0; this.data = data; this._renderHTML(); - this._initPlugins(); + this.fire('reloadData'); this.isAutoplay && this.play(); }; diff --git a/src/js/plugins/dot.js b/src/js/plugins/dot.js index 853a1d2f..a7ab0672 100644 --- a/src/js/plugins/dot.js +++ b/src/js/plugins/dot.js @@ -31,21 +31,27 @@ var dots = []; var dotWrap = document.createElement('ul'); dotWrap.className = 'islider-dot-wrap'; - var fregment = document.createDocumentFragment(); - for (var i = 0; i < data.length; i++) { - dots[i] = document.createElement('li'); - dots[i].className = 'islider-dot'; - dots[i].setAttribute('index', i); - if (i === HANDLE.slideIndex) { - dots[i].className += ' active'; + + var renderDots = function renderDots() { + var fregment = document.createDocumentFragment(); + for (var i = 0; i < data.length; i++) { + dots[i] = document.createElement('li'); + dots[i].className = 'islider-dot'; + dots[i].setAttribute('index', i); + if (i === HANDLE.slideIndex) { + dots[i].className += ' active'; + } + dots[i].onclick = function () { + HANDLE.slideTo(parseInt(this.getAttribute('index'), 10)); + }; + fregment.appendChild(dots[i]); } - dots[i].addEventListener('click', function () { - var index = parseInt(this.getAttribute('index'), 10); - HANDLE.slideTo(index); - }); - fregment.appendChild(dots[i]); - } - dotWrap.appendChild(fregment); + dotWrap.innerHTML = ''; + dotWrap.appendChild(fregment); + }; + + renderDots(); + HANDLE.wrap.parentNode.appendChild(dotWrap); HANDLE.on('slideChange', function () { @@ -58,6 +64,12 @@ } } }); + + HANDLE.on('reloadData', function () { + data = this.data; + dots = []; + renderDots(); + }); } }); }); From 7ef551a8db0c8cef42aa239a80bf3613e6ba8ffd Mon Sep 17 00:00:00 2001 From: shinate Date: Wed, 9 Sep 2015 17:20:53 +0800 Subject: [PATCH 03/18] logo move to top --- README.md | 4 ++-- README_Chinese.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 93def5f4..315f475b 100755 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # iSlider +![](thumbnails/logo.png) + #### [iSlider English Official Page](http://be-fe.github.io/iSlider/index_en.html) #### [iSlider English README](https://github.com/BE-FE/iSlider/blob/master/README.md) #### [iSlider 中文官网](http://be-fe.github.io/iSlider/index.html) #### [iSlider Example](http://be-fe.github.io/iSlider/demo/) -![](thumbnails/logo.png) - iSlider is a light-weight, high performance, dependency free, yet cross-platform plugin. It can help handling most sliding effects, offering dozens of transition animation, and presenting various scenarios. diff --git a/README_Chinese.md b/README_Chinese.md index e52229a0..7c143c25 100755 --- a/README_Chinese.md +++ b/README_Chinese.md @@ -1,12 +1,12 @@ # iSlider +![](thumbnails/logo.png) + #### [iSlider English Official Page](http://be-fe.github.io/iSlider/index_en.html) #### [iSlider English README](https://github.com/BE-FE/iSlider/blob/master/README.md) #### [iSlider 中文官网](http://be-fe.github.io/iSlider/index.html) #### [iSlider Example](http://be-fe.github.io/iSlider/demo/) -![](thumbnails/logo.png) - iSlider是一个轻量且高性能,无任何库依赖的跨平台滑动控件。 它能够处理大多数的滑动场景,提供多种切换动画效果,展示多种类型的场景。 From 49482fef8c3ff509122f6abf787539297ef30d87 Mon Sep 17 00:00:00 2001 From: shinate Date: Thu, 24 Sep 2015 10:12:07 +0800 Subject: [PATCH 04/18] readme updated --- README.md | 16 ++-- README_Chinese.md | 2 +- README_en_bak.md | 214 ---------------------------------------------- 3 files changed, 9 insertions(+), 223 deletions(-) delete mode 100755 README_en_bak.md diff --git a/README.md b/README.md index 315f475b..6eff9449 100755 --- a/README.md +++ b/README.md @@ -31,14 +31,14 @@ You can either: - Download directly from Github - Run `bower install iSlider` if bower is used -- Run `npm install islider.js` +- Run `npm install islider.js` ## Get started The easiest way to get your hands dirty is to have a try the cases that we offer. Please refer to the folder `demo/` for more information. #### Creating a container - + ``` html
    ``` @@ -188,7 +188,7 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE - type + type (Soon abandoned or renamed) {string} Sets to `pic` will enable global images preload. Default: null (disabled) @@ -357,7 +357,7 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE [{object} one-off configuration (optional)] - Slide to the N scene. Using the one-off configuration param, the transition effect + Slide to the N scene. Using the one-off configuration param, the transition effect for this particular slide can be specified. i.e. animateTime, animateType @@ -369,7 +369,7 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE [{object} one-off configuration (optional)] - Slide to the next scene. The one-off configuration can be used to specify the + Slide to the next scene. The one-off configuration can be used to specify the transition effect. i.e. animateTime, animateType @@ -381,7 +381,7 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE [{object} one-off configuration (optional)] - Slide to the previous scene. The one-off configration can be used to specify the + Slide to the previous scene. The one-off configration can be used to specify the transition effect. i.e. animateTime, animateType @@ -482,7 +482,7 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE - Start auto-play (auto-play mode must be specified) + Start auto-play (auto-play mode must be specified) @@ -531,7 +531,7 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE - Prevents the scene from any gesture + Prevents the scene from any gesture diff --git a/README_Chinese.md b/README_Chinese.md index 7c143c25..efcf7b91 100755 --- a/README_Chinese.md +++ b/README_Chinese.md @@ -185,7 +185,7 @@ var data = [{ - type + type (即将废弃或更名) {string} 设置为'pic'将开启全局图图片预加载功能,默认:null(不开启) diff --git a/README_en_bak.md b/README_en_bak.md deleted file mode 100755 index f0dad319..00000000 --- a/README_en_bak.md +++ /dev/null @@ -1,214 +0,0 @@ -# iSlider,Smooth slider for webapps - -#### [iSlider Official Page](http://be-fe.github.io/iSlider/index_en.html) -#### [iSlider 官网](http://be-fe.github.io/iSlider/index.html) -#### [iSlider 说明](https://github.com/BE-FE/iSlider/blob/master/README_Chinese.md) -#### [iSlider Example](http://be-fe.github.io/iSlider/demo/) - -iSlider is a high performance,dependency free, mobile-platform javascript slider. -It can handle any elements that need to be slide, like picture list or different dom elements. -It features: - -* Performance is extremely great with hardware acceleration and little memory consumption. -* Animation can be customized with user defined functions (default, rotate, depth, flow, flip, card). -* You can easily hook to a plethora of custom events (onslidestart, onslide, onslideend, onslidechange). -* Damping effect, Infinite Looping, Autometic sliding and Vertical/Horizontal Sliding can be configured. -* Support desktop gesture which is convenient for testing. -* Support image preloader to improve user experience. -* Support image zoomIn and zoomOut. - -## Get iSlider -- You could download the sourcecode form github here. -- Using `bower install iSlider`. -- Using `npm install islider.js` - -## iSlider Mobile Demo - -![](qrcode.png) - -Demo [http://be-fe.github.io/iSlider/index.html](http://be-fe.github.io/iSlider/index.html) - -## Getting Started -The best way to learn the iSlider is by looking at the demos. In the archive you'll find a demo folder. Most of the script features are outlined there. -*iSlider* is a class that needs to be initiated for each dom area. - -Before you start, you need to prepare some data for iSlider: - -```` -var data = [ - {content: "imgs/1.jpg"}, - {content: "imgs/2.jpg"}, - {content: "imgs/3.jpg"} -]; -```` - -HTML structure you only need to prepare is : - -
    - -To make it runnable, all you need to do is to initiate: - - - -If you want to add more effects or options, you can follow the demo in demo/picture - - - -That's it. - -## Configure the iSlider -Besides the basic ways you can do with iSlider, you can customized the features we provide. For example, if you prefers to put dom elements on the list, you can change the data array like this: - -```` -var data = [{ - 'content' : '

    Home

    This is home page

    home is pretty awsome

    ' -},{ - 'content' : '

    Page1

    This is page1

    page1 is pretty awsome

    ' -},{ - 'content' : '

    Page2

    This is Page2

    Page2 is pretty awsome

    ' -}]; -```` -If you hope to implement the effects mentioned in introduction part, you can: - - - -## Understand The iSlider -the demo is only basic usage of iSlider,you can get more from [WIKI](https://github.com/BE-FE/iSlider/wiki/Notices). - -Here provides a clear description of what options you are able to manipulate: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    OptionValueDescription
    domHTML ObjectThe DOM element that wraps image list
    dataArray of Content(picture | html)Picture data, for example: -
    -[{
    -	content:"pics/1.jpg"
    -}]
    -		
    -
    typeString (pic | dom)Default value is 'pic', 'dom' is also supported 。Indispensable
    durationInteger (1000 == 1s)Time gap when an image slides. Applied only to isAutoplay is true
    animateTypeStringCurrently, default, rotate, flow, depth, flip and card are supported animations
    onslideFunctionCallback function when your finger is moving
    onslidestartFunctionCallback function when your finger touch the screen
    onslideendFunctionCallback function when your finger move out of the screen
    onslidechangeFunctionCallback function when the autoplay mode is on and one image slides
    isDebugBoolean (true | false)Turn on/off the debug mode. Some debug message will output
    isLoopingBoolean (true | false)Turn on/off infinite looping mode
    isAutoplayBoolean (true | false)Turn of/off autoplay mode
    isVerticalBoolean (true | fasle)Slide verically or horizontally
    isOverspreadBoolean (true | fasle)Decide whether to cover the whole browser screen or not
    initIndexNumberinit content index in data
    useZoomBoolean (true | fasle)Decide whether to open picture zoomIn and zoomOut
    -## Contact us -if you have any questions or find any bugs, please post issues to tell us. -[Feedback](https://github.com/BE-FE/iSlider/issues/new?title=Bug%3A%20&body=) - -## License (MIT) - -Copyright (c) 2014 BE-FE - -[MIT](https://github.com/BE-FE/iSlider/blob/master/LICENSE) From 38c4ffaa8c02ce9d736f2594d33a2c396ff2b4e5 Mon Sep 17 00:00:00 2001 From: shinate Date: Thu, 24 Sep 2015 16:51:17 +0800 Subject: [PATCH 05/18] css compatibility, remove assignment size during initialization --- build/iSlider.css | 41 ++++++++++++++------------- build/iSlider.js | 10 +++---- build/iSlider.min.css | 2 +- build/iSlider.min.js | 2 +- build/iSlider.plugin.dot.js | 40 ++++++++++++++++---------- build/iSlider.plugin.dot.min.js | 2 +- demo/public/css/iSlider.css | 41 ++++++++++++++------------- demo/public/js/iSlider.js | 10 +++---- demo/public/js/iSlider.plugin.dot.js | 40 ++++++++++++++++---------- src/index.html | 42 +--------------------------- src/js/iSlider.js | 6 ++-- src/style/iSlider.css | 41 ++++++++++++++------------- 12 files changed, 132 insertions(+), 145 deletions(-) diff --git a/build/iSlider.css b/build/iSlider.css index dacf13f7..b16cf947 100755 --- a/build/iSlider.css +++ b/build/iSlider.css @@ -1,25 +1,30 @@ /** * @file iSlider.css */ -.islider-pic, -.islider-dom, -.islider-node, -.islider-html, -.islider-element { - position: absolute; +.islider-outer { + display: block; + list-style: none; margin: 0; padding: 0; - top: 0; - left: 0; height: 100%; overflow: hidden; } -.islider-pic { +.islider-outer > li { + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + list-style: none; + overflow: hidden; display: -webkit-box; -webkit-box-pack: center; + box-pack: center; -webkit-box-align: center; - list-style: none; + box-align: center; } .islider-img > img { @@ -36,7 +41,7 @@ bottom: 0; margin: auto 0; display: block; - background-color: rgb(119, 119, 119); + background-color: #777777; } .islider-btn-outer.left { @@ -51,12 +56,8 @@ position: absolute; width: 50%; height: 50%; - border-top-width: 2px; - border-top-style: solid; - border-top-color: rgb(255, 255, 255); - border-left-width: 2px; - border-left-style: solid; - border-left-color: rgb(255, 255, 255); + border-top: 2px solid #ffffff; + border-left: 2px solid #ffffff; margin: auto; top: 0; bottom: 0; @@ -66,10 +67,12 @@ .islider-btn-outer.left > .islider-btn-inner { -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); } .islider-btn-outer.right > .islider-btn-inner { -webkit-transform: rotate(135deg); + transform: rotate(135deg); } .islider-dot-wrap { @@ -91,13 +94,13 @@ width: 0.8em; height: 0.8em; border-radius: 50%; - border: 1px solid rgb(255, 255, 255); + border: 1px solid #ffffff; list-style-type: none; margin: 5px; } .islider-dot.active { - background-color: #fff; + background-color: #ffffff; } .islider-loader { diff --git a/build/iSlider.js b/build/iSlider.js index f9b3511a..d909276e 100644 --- a/build/iSlider.js +++ b/build/iSlider.js @@ -136,7 +136,7 @@ * @type {Array} * @protected */ - iSlider.EVENTS = 'slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored destroy'.split(' '); + iSlider.EVENTS = 'slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored reloadData destroy'.split(' '); /** * Easing white list @@ -649,22 +649,20 @@ // initail ul element var outer = this.outer || document.createElement('ul'); outer.className = 'islider-outer'; - outer.style.cssText = 'height:' + this.height + 'px;width:' + this.width + 'px;margin:0;padding:0;list-style:none;'; - //loading + // loading if (this.type === 'pic' && !this.loader && this.isLoading) { var loader = document.createElement('div'); loader.className = 'islider-loader'; this.loader = loader; this.wrap.appendChild(loader); + this.fire('loading'); } // storage li elements, only store 3 elements to reduce memory usage this.els = []; for (var i = 0; i < 3; i++) { var li = document.createElement('li'); - // li.className = this.type === 'dom' ? 'islider-dom' : 'islider-pic'; - li.style.cssText = 'height:' + this.height + 'px;width:' + this.width + 'px;'; this.els.push(li); // prepare style animation @@ -1268,7 +1266,7 @@ this.slideIndex = initIndex || 0; this.data = data; this._renderHTML(); - this._initPlugins(); + this.fire('reloadData'); this.isAutoplay && this.play(); }; diff --git a/build/iSlider.min.css b/build/iSlider.min.css index e5e4efd5..39bc68cc 100755 --- a/build/iSlider.min.css +++ b/build/iSlider.min.css @@ -1 +1 @@ -.islider-dom,.islider-element,.islider-html,.islider-node,.islider-pic{position:absolute;margin:0;padding:0;top:0;left:0;height:100%;overflow:hidden}.islider-pic{display:-webkit-box;-webkit-box-pack:center;-webkit-box-align:center;list-style:none}.islider-img>img{max-width:100%;max-height:100%}.islider-btn-outer{position:absolute;width:3em;height:3em;cursor:pointer;top:0;bottom:0;margin:auto 0;display:block;background-color:#777}.islider-btn-outer.left{left:5%}.islider-btn-outer.right{right:5%}.islider-btn-inner{position:absolute;width:50%;height:50%;border-top-width:2px;border-top-style:solid;border-top-color:#fff;border-left-width:2px;border-left-style:solid;border-left-color:#fff;margin:auto;top:0;bottom:0;left:0;right:0}.islider-btn-outer.left>.islider-btn-inner{-webkit-transform:rotate(-45deg)}.islider-btn-outer.right>.islider-btn-inner{-webkit-transform:rotate(135deg)}.islider-dot-wrap{width:80%;height:10%;margin:0 auto;position:absolute;padding:0;left:0;right:0;bottom:0;z-index:10000;text-align:center}.islider-dot{position:relative;display:inline-block;width:.8em;height:.8em;border-radius:50%;border:1px solid #fff;list-style-type:none;margin:5px}.islider-dot.active{background-color:#fff}.islider-loader{display:none;font-size:5px;margin:auto;width:1em;height:1em;border-radius:50%;text-indent:-9999em;position:absolute;top:50%;left:0;right:0;-webkit-animation:isliderload 1s infinite linear;animation:isliderload 1s infinite linear}@-webkit-keyframes isliderload{0%,100%{box-shadow:0 -3em 0 .2em #fff,2em -2em 0 0 #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 0 #fff}12.5%{box-shadow:0 -3em 0 0 #fff,2em -2em 0 .2em #fff,3em 0 0 0 #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}25%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 0 #fff,3em 0 0 .2em #fff,2em 2em 0 0 #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}37.5%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 0 #fff,2em 2em 0 .2em #fff,0 3em 0 0 #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}50%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 0 #fff,0 3em 0 .2em #fff,-2em 2em 0 0 #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}62.5%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 0 #fff,-2em 2em 0 .2em #fff,-3em 0 0 0 #fff,-2em -2em 0 -.5em #fff}75%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 0 #fff,-3em 0 0 .2em #fff,-2em -2em 0 0 #fff}87.5%{box-shadow:0 -3em 0 0 #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 0 #fff,-3em 0 0 0 #fff,-2em -2em 0 .2em #fff}}@keyframes isliderload{0%,100%{box-shadow:0 -3em 0 .2em #fff,2em -2em 0 0 #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 0 #fff}12.5%{box-shadow:0 -3em 0 0 #fff,2em -2em 0 .2em #fff,3em 0 0 0 #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}25%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 0 #fff,3em 0 0 .2em #fff,2em 2em 0 0 #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}37.5%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 0 #fff,2em 2em 0 .2em #fff,0 3em 0 0 #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}50%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 0 #fff,0 3em 0 .2em #fff,-2em 2em 0 0 #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}62.5%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 0 #fff,-2em 2em 0 .2em #fff,-3em 0 0 0 #fff,-2em -2em 0 -.5em #fff}75%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 0 #fff,-3em 0 0 .2em #fff,-2em -2em 0 0 #fff}87.5%{box-shadow:0 -3em 0 0 #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 0 #fff,-3em 0 0 0 #fff,-2em -2em 0 .2em #fff}} \ No newline at end of file +.islider-outer,.islider-outer>li{margin:0;height:100%;list-style:none;overflow:hidden;padding:0}.islider-outer{display:block}.islider-outer>li{position:absolute;top:0;left:0;width:100%;display:-webkit-box;-webkit-box-pack:center;box-pack:center;-webkit-box-align:center;box-align:center}.islider-img>img{max-width:100%;max-height:100%}.islider-btn-outer{position:absolute;width:3em;height:3em;cursor:pointer;top:0;bottom:0;margin:auto 0;display:block;background-color:#777}.islider-btn-outer.left{left:5%}.islider-btn-outer.right{right:5%}.islider-btn-inner{position:absolute;width:50%;height:50%;border-top:2px solid #fff;border-left:2px solid #fff;margin:auto;top:0;bottom:0;left:0;right:0}.islider-btn-outer.left>.islider-btn-inner{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.islider-btn-outer.right>.islider-btn-inner{-webkit-transform:rotate(135deg);transform:rotate(135deg)}.islider-dot-wrap{width:80%;height:10%;margin:0 auto;position:absolute;padding:0;left:0;right:0;bottom:0;z-index:10000;text-align:center}.islider-dot{position:relative;display:inline-block;width:.8em;height:.8em;border-radius:50%;border:1px solid #fff;list-style-type:none;margin:5px}.islider-dot.active{background-color:#fff}.islider-loader{display:none;font-size:5px;margin:auto;width:1em;height:1em;border-radius:50%;text-indent:-9999em;position:absolute;top:50%;left:0;right:0;-webkit-animation:isliderload 1s infinite linear;animation:isliderload 1s infinite linear}@-webkit-keyframes isliderload{0%,100%{box-shadow:0 -3em 0 .2em #fff,2em -2em 0 0 #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 0 #fff}12.5%{box-shadow:0 -3em 0 0 #fff,2em -2em 0 .2em #fff,3em 0 0 0 #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}25%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 0 #fff,3em 0 0 .2em #fff,2em 2em 0 0 #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}37.5%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 0 #fff,2em 2em 0 .2em #fff,0 3em 0 0 #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}50%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 0 #fff,0 3em 0 .2em #fff,-2em 2em 0 0 #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}62.5%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 0 #fff,-2em 2em 0 .2em #fff,-3em 0 0 0 #fff,-2em -2em 0 -.5em #fff}75%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 0 #fff,-3em 0 0 .2em #fff,-2em -2em 0 0 #fff}87.5%{box-shadow:0 -3em 0 0 #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 0 #fff,-3em 0 0 0 #fff,-2em -2em 0 .2em #fff}}@keyframes isliderload{0%,100%{box-shadow:0 -3em 0 .2em #fff,2em -2em 0 0 #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 0 #fff}12.5%{box-shadow:0 -3em 0 0 #fff,2em -2em 0 .2em #fff,3em 0 0 0 #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}25%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 0 #fff,3em 0 0 .2em #fff,2em 2em 0 0 #fff,0 3em 0 -.5em #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}37.5%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 0 #fff,2em 2em 0 .2em #fff,0 3em 0 0 #fff,-2em 2em 0 -.5em #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}50%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 0 #fff,0 3em 0 .2em #fff,-2em 2em 0 0 #fff,-3em 0 0 -.5em #fff,-2em -2em 0 -.5em #fff}62.5%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 0 #fff,-2em 2em 0 .2em #fff,-3em 0 0 0 #fff,-2em -2em 0 -.5em #fff}75%{box-shadow:0 -3em 0 -.5em #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 0 #fff,-3em 0 0 .2em #fff,-2em -2em 0 0 #fff}87.5%{box-shadow:0 -3em 0 0 #fff,2em -2em 0 -.5em #fff,3em 0 0 -.5em #fff,2em 2em 0 -.5em #fff,0 3em 0 -.5em #fff,-2em 2em 0 0 #fff,-3em 0 0 0 #fff,-2em -2em 0 .2em #fff}} \ No newline at end of file diff --git a/build/iSlider.min.js b/build/iSlider.min.js index f6105dbc..fd41bae2 100644 --- a/build/iSlider.min.js +++ b/build/iSlider.min.js @@ -1 +1 @@ -!function(t){"use strict";function i(t,i){return i.indexOf(t)>-1}function e(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t,i){return t.className.match(new RegExp("(\\s|^)"+i+"(\\s|$)"))}function n(t,i){s(t,i)||(t.className+=" "+i)}function a(t,i){s(t,i)&&(t.className=t.className.replace(RegExp("(\\s|^)"+i+"(\\s|$)"),""))}function h(t){if(/<\/?[^>]*>/g.test(t))return!1;var i="^(((https|http|ftp|rtsp|mms):)?//)?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})?(:[0-9]{1,4})?([^?#]+)?(\\?[^#]+)?(#.+)?$";return new RegExp(i).test(t)}var r=function(t){if(!t.dom)throw new Error("Container can not be empty!");if(!t.data||!t.data.length)throw new Error("Data must be an array and must have more than one element!");this._opts=t,this._setting(),this._renderHTML(),this._initPlugins(),this._bindHandler()};r.EVENTS="slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored destroy".split(" "),r.EASING=["linear ease ease-in ease-out ease-in-out".split(" "),/cubic-bezier\(([^\d]*(\d+.?\d*)[^\,]*\,?){4}\)/],r.EMPTY_FUNCTION=function(){},r.extend=function(){if(arguments.length){var t,i;switch(arguments.length){case 1:t=r.prototype,i=arguments[0];break;case 2:t=arguments[0],i=arguments[1]}for(var e in i)i.hasOwnProperty(e)&&(t[e]=i[e])}},r.plugins={},r.regPlugin=function(t,i){r.plugins[t]=r.plugins[t]||i},r._animateFuncs={"default":function(t,i,e,s,n){t.style.webkitTransform="translateZ(0) translate"+i+"("+(n+e*(s-1))+"px)"}},r._transitionEndEvent=function(){var t;return function(){if(t)return t;var i=document.createElement("fakeElement"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(var s in e)if(e.hasOwnProperty(s)&&void 0!==i.style[s])return t=e[s]}}();var o=r.prototype;o.extend=r.extend,o._setting=function(){this._plugins=r.plugins,this._animateFuncs=r._animateFuncs,this.holding=!1,this.locking=!1;var s=this._opts;this.wrap=s.dom,this.data=s.data,this.type=s.type||null,this.isVertical=s.isVertical||!1,this.isOverspread=s.isOverspread||!1,this.duration=s.duration||2e3,this.initIndex=s.initIndex||0,this.fixPage=void 0===s.fixPage?!0:s.fixPage,(this.initIndex>this.data.length-1||this.initIndex<0)&&(this.initIndex=0),this.slideIndex=this.slideIndex||this.initIndex||0,this.axis=this.isVertical?"Y":"X",this.reverseAxis="Y"===this.axis?"X":"Y",this.width=this.wrap.clientWidth,this.height=this.wrap.clientHeight,this.ratio=this.height/this.width,this.scale=this.isVertical?this.height:this.width,this.isLoading=s.isLoading,this.offset=this.offset||{X:0,Y:0},this.data.length<2?(this.isLooping=!1,this.isAutoPlay=!1):(this.isLooping=s.isLooping||!1,this.isAutoplay=s.isAutoplay||!1),"card"===s.animateType&&this.isVertical&&(this.isOverspread=!0),this.log=s.isDebug?function(){t.console.log.apply(t.console,arguments)}:r.EMPTY_FUNCTION,this._setUpDamping(),this._animateFunc=this._animateFuncs[s.animateType in this._animateFuncs?s.animateType:"default"],this.animateTime=null!=s.animateTime&&s.animateTime>-1?s.animateTime:300,this.animateEasing=i(s.animateEasing,r.EASING[0])||r.EASING[1].test(s.animateEasing)?s.animateEasing:"ease",this.inAnimate=0,this.deviceEvents=function(){var i=!!("ontouchstart"in t||t.DocumentTouch&&document instanceof t.DocumentTouch);return{hasTouch:i,startEvt:i?"touchstart":"mousedown",moveEvt:i?"touchmove":"mousemove",endEvt:i?"touchend":"mouseup"}}(),this.events={},this.on("slide",s.onslide),this.on("slideStart",s.onslidestart),this.on("slideEnd",s.onslideend),this.on("slideChange",s.onslidechange),this.on("slideChanged",s.onslidechanged),this.on("slideRestore",s.onsliderestore),this.on("slideRestored",s.onsliderestored),this.pluginConfig=function(){if(e(s.plugins)){var t={};return s.plugins.forEach(function(i){e(i)?t[i[0]]=i.slice(1):"string"==typeof i&&(t[i]=[])}),t}return{}}(),this.isAutoplay&&this.play()},o._initPlugins=function(){var t=this.pluginConfig,i=this._plugins;for(var e in t)t.hasOwnProperty(e)&&i.hasOwnProperty(e)&&(this.log("[INIT PLUGIN]:",e,i[e]),i[e]&&"function"==typeof i[e]&&typeof i[e].apply&&i[e].apply(this,t[e]))},o._setUpDamping=function(){var t=this.scale>>1,i=t>>1,e=i>>2;this._damping=function(s){var n,a=Math.abs(s);return n=t>a?a>>1:t+i>a?i+(a-t>>2):i+e+(a-t-i>>3),s>0?n:-n}},o._itemType=function(t){var i=this.data[t].content;return null==i?"empty":Boolean(i.nodeName)&&Boolean(i.nodeType)?"node":"string"==typeof i?h(i)?"pic":"html":"unknown"},o._renderItem=function(t,i){var e,s,n=this.data.length,a=function(){s=e.height/e.width>this.ratio?'':'',t.innerHTML=s}.bind(this);if(t.innerHTML="",t.style.background="",this.isLooping||null!=this.data[i]){i=(n+i)%n,e=this.data[i];var h=null!=this.type?this.type:e.type||(e.type=this._itemType(i));switch(this.log("[Render ITEM]:",h,i,e),t.className="islider-"+h,h){case"pic":if(this.isOverspread)t.style.background="url("+e.content+") no-repeat 50% 50%/cover";else if(e.height&&e.width)a();else{var r=new Image;r.src=e.content,r.onload=function(){e.height=r.height,e.width=r.width,a()}}break;case"dom":case"html":t.innerHTML=e.content;break;case"node":case"element":if(11===e.content.nodeType){var o=document.createElement("div");o.appendChild(e.content),e.content=o}t.appendChild(e.content)}}},o._renderIntermediateScene=function(){null!=this._intermediateScene&&(this._renderItem.apply(this,this._intermediateScene),this._intermediateScene=null)},o._changedStyles=function(){var t=["islider-prev","islider-active","islider-next"];this.els.forEach(function(i,e){a(i,"("+t.join("|")+")"),n(i,t[e])})},o._renderHTML=function(){this.outer&&(this.outer.innerHTML="");var t=this.outer||document.createElement("ul");if(t.className="islider-outer",t.style.cssText="height:"+this.height+"px;width:"+this.width+"px;margin:0;padding:0;list-style:none;","pic"===this.type&&!this.loader&&this.isLoading){var i=document.createElement("div");i.className="islider-loader",this.loader=i,this.wrap.appendChild(i)}this.els=[];for(var e=0;3>e;e++){var s=document.createElement("li");s.style.cssText="height:"+this.height+"px;width:"+this.width+"px;",this.els.push(s),this._animateFunc(s,this.axis,this.scale,e,0),!this.isVertical||"rotate"!==this._opts.animateType&&"flip"!==this._opts.animateType?this._renderItem(s,e-1+this.slideIndex):this._renderItem(s,1-e+this.slideIndex),t.appendChild(s)}this._changedStyles(),this._initLoadImg(),this.outer||(this.outer=t,this.wrap.appendChild(t))},o._preloadImg=function(t){if("pic"===this.type&&this.data.length>3){var i=this.data,e=i.length,s=function(t){if(t>-1&&"pic"===i[t].type&&!i[t].loaded){var e=new Image;e.src=i[t].content,e.onload=function(){i[t].width=e.width,i[t].height=e.height},i[t].loaded=1}};s(t+2>e-1?(t+2)%e:t+2),s(0>t-2?e-2+t:t-2)}},o._initLoadImg=function(){var t=this.data,i=t.length,e=this.slideIndex,s=this;if("pic"===this.type&&i>3){var n=e+2>i?(e+1)%i:e+1,a=0>e-1?i-1+e:e-1;t[e].loaded=1,t[n].loaded=1,s.isLooping&&(t[a].loaded=1),setTimeout(function(){s._preloadImg(e)},200)}},o._watchTransitionEnd=function(i,e){function s(){a&&t.clearTimeout(a),h.inAnimate--,h.log("Event:","watchTransitionEnd::stuck::release",h.inAnimate),0===h.inAnimate&&("slideChanged"===e&&h._changedStyles(),h.fire.apply(h,o),h._renderIntermediateScene()),n()}function n(){h.els.forEach(function(t){t.removeEventListener(r._transitionEndEvent(),s)}),h.isAnimating=!1}var a,h=this,o=Array.prototype.slice.call(arguments,1);this.log("Event:","watchTransitionEnd::stuck::pile",this.inAnimate),i>0&&h.els.forEach(function(t){t.addEventListener(r._transitionEndEvent(),s)}),a=t.setTimeout(s,i),h.inAnimate++},o._bindHandler=function(){var i=this.outer,e=this.deviceEvents;e.hasTouch||(i.style.cursor="pointer",i.ondragstart=function(t){return t?!1:!0}),i.addEventListener(e.startEvt,this),i.addEventListener(e.moveEvt,this),i.addEventListener(e.endEvt,this),t.addEventListener("orientationchange",this),t.addEventListener("focus",this,!1),t.addEventListener("blur",this,!1)},o.handleEvent=function(t){var i=this.deviceEvents;switch(t.type){case i.startEvt:this.startHandler(t);break;case i.moveEvt:this.moveHandler(t);break;case i.endEvt:this.endHandler(t);break;case"touchcancel":this.endHandler(t);break;case"orientationchange":this.orientationchangeHandler();break;case"focus":this.isAutoplay&&this.play();break;case"blur":this.pause()}},o.startHandler=function(t){if(this.fixPage){var i=t.target,e=["SELECT","INPUT","TEXTAREA","BUTTON","LABEL"];e.indexOf(i.tagName)<0&&t.preventDefault()}if(!this.holding&&!this.locking){var s=this.deviceEvents;this.isMoving=!0,this.pause(),this.log("Event: start"),this.fire("slideStart",t,this),this.startTime=(new Date).getTime(),this.startX=s.hasTouch?t.targetTouches[0].pageX:t.pageX,this.startY=s.hasTouch?t.targetTouches[0].pageY:t.pageY}},o.moveHandler=function(t){if(this.isMoving){this.log("Event: moving");var i=this.deviceEvents,e=this.data.length,s=this.axis,n=this.reverseAxis,a={X:i.hasTouch?t.targetTouches[0].pageX-this.startX:t.pageX-this.startX,Y:i.hasTouch?t.targetTouches[0].pageY-this.startY:t.pageY-this.startY};if(this.offset=a,Math.abs(a[s])-Math.abs(a[n])>10){t.preventDefault(),this.fire("slide",t,this),this.isLooping||(a[s]>0&&0===this.slideIndex||a[s]<0&&this.slideIndex===e-1)&&(a[s]=this._damping(a[s]));for(var h=0;3>h;h++){var r=this.els[h];r.style.webkitTransition="all 0s",this._animateFunc(r,s,this.scale,h,a[s])}}}},o.endHandler=function(i){if(this.isMoving){this.log("Event: end"),this.isMoving=!1;var e=this.offset,s=this.axis,n=this.scale/2,a=(new Date).getTime();n=a-this.startTime>300?n:14;var h=Math.abs(e[s]),r=Math.abs(e[this.reverseAxis]),o=function(i){if("A"===i.tagName){if(i.href)return t.location.href=i.href,!1}else{if("islider-pic"!==i.className)return!1;o(i.parentNode)}};this.log(n,e[s],h,r,this),this.slideTo(e[s]>=n&&h>r?this.slideIndex-1:e[s]<-n&&h>r?this.slideIndex+1:this.slideIndex),Math.abs(this.offset.X)<10&&Math.abs(this.offset.Y)<10&&(this.tapEvt=document.createEvent("Event"),this.tapEvt.initEvent("tap",!0,!0),this.fixPage&&i.target&&o(i.target),i.target.dispatchEvent(this.tapEvt)||i.preventDefault()),this.offset.X=this.offset.Y=0,this.isAutoplay&&this.play(),this.fire("slideEnd",i,this)}},o.orientationchangeHandler=function(){setTimeout(function(){this.reset(),this.log("Event: orientationchange")}.bind(this),100)},o.slideTo=function(t,i){if(!this.locking){this.unhold();var e,s=this.animateTime,n=this._opts.animateType,a=this._animateFunc,h=this.data,r=this.els,o=t,l=t-this.slideIndex,d=this.offset;"object"==typeof i&&(i.animateTime>-1&&(s=i.animateTime),"string"==typeof i.animateType&&i.animateType in this._animateFuncs&&(n=i.animateType,a=this._animateFuncs[n]));var c=Math.abs(d[this.axis])/this.scale*s;Math.abs(l)>1&&this._renderItem(l>0?this.els[2]:this.els[0],o),this._preloadImg(o),h[o]?this.slideIndex=o:this.isLooping?this.slideIndex=l>0?0:h.length-1:(this.slideIndex=this.slideIndex,l=0),this.log("Index:"+this.slideIndex);var u,p;if(0===l)e="slideRestore";else{var f=(this.isVertical&&("rotate"===n||"flip"===n))^l>0;f?(r.push(r.shift()),u=r[2],p=r[0]):(r.unshift(r.pop()),u=r[0],p=r[2]),1===Math.abs(l)?(this._renderIntermediateScene(),this._renderItem(u,o+l)):Math.abs(l)>1&&(this._renderItem(u,o+(f?1:-1)),this._intermediateScene=[p,o+(f?-1:1)]),u.style.webkitTransition="none",u.style.visibility="hidden",setTimeout(function(){u.style.visibility="visible"},200),c=s-c,e="slideChange"}this.fire(e,this.slideIndex,r[1],this),this._watchTransitionEnd(c,e+"d",this.slideIndex,r[1],this);for(var g=0;3>g;g++)r[g]!==u&&(r[g].style.webkitTransition="all "+c/1e3+"s "+this.animateEasing),a.call(this,r[g],this.axis,this.scale,g,0);this.isAutoplay&&!this.isLooping&&this.slideIndex===h.length-1&&this.pause()}},o.slideNext=function(){this.slideTo.apply(this,[this.slideIndex+1].concat(Array.prototype.slice.call(arguments)))},o.slidePrev=function(){this.slideTo.apply(this,[this.slideIndex-1].concat(Array.prototype.slice.call(arguments)))},o.regPlugin=function(){var t=Array.prototype.slice.call(arguments),e=t.shift(),s=t[0];(this._plugins.hasOwnProperty(e)||"function"==typeof s)&&("function"==typeof s&&(this._plugins[e]=s,t.shift()),i(e,this._opts.plugins)||(this._opts.plugins.push(t.length?[].concat([e],t):e),"function"==typeof this._plugins[e]&&this._plugins[e].apply(this,t)))},o.bind=o.delegate=function(i,e,s){function n(i){for(var n=t.event?t.event:i,a=n.target,h=document.querySelectorAll(e),r=0;r-1&&delete e[s]}},o.fire=function(t){if(this.log("[EVENT FIRE]:",t,arguments),t in this.events)for(var i=this.events[t],e=0;e-1}function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t,e){return t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function n(t,e){s(t,e)||(t.className+=" "+e)}function a(t,e){s(t,e)&&(t.className=t.className.replace(RegExp("(\\s|^)"+e+"(\\s|$)"),""))}function h(t){if(/<\/?[^>]*>/g.test(t))return!1;var e="^(((https|http|ftp|rtsp|mms):)?//)?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})?(:[0-9]{1,4})?([^?#]+)?(\\?[^#]+)?(#.+)?$";return new RegExp(e).test(t)}var r=function(t){if(!t.dom)throw new Error("Container can not be empty!");if(!t.data||!t.data.length)throw new Error("Data must be an array and must have more than one element!");this._opts=t,this._setting(),this._renderHTML(),this._initPlugins(),this._bindHandler()};r.EVENTS="slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored reloadData destroy".split(" "),r.EASING=["linear ease ease-in ease-out ease-in-out".split(" "),/cubic-bezier\(([^\d]*(\d+.?\d*)[^\,]*\,?){4}\)/],r.EMPTY_FUNCTION=function(){},r.extend=function(){if(arguments.length){var t,e;switch(arguments.length){case 1:t=r.prototype,e=arguments[0];break;case 2:t=arguments[0],e=arguments[1]}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}},r.plugins={},r.regPlugin=function(t,e){r.plugins[t]=r.plugins[t]||e},r._animateFuncs={"default":function(t,e,i,s,n){t.style.webkitTransform="translateZ(0) translate"+e+"("+(n+i*(s-1))+"px)"}},r._transitionEndEvent=function(){var t;return function(){if(t)return t;var e=document.createElement("fakeElement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(var s in i)if(i.hasOwnProperty(s)&&void 0!==e.style[s])return t=i[s]}}();var o=r.prototype;o.extend=r.extend,o._setting=function(){this._plugins=r.plugins,this._animateFuncs=r._animateFuncs,this.holding=!1,this.locking=!1;var s=this._opts;this.wrap=s.dom,this.data=s.data,this.type=s.type||null,this.isVertical=s.isVertical||!1,this.isOverspread=s.isOverspread||!1,this.duration=s.duration||2e3,this.initIndex=s.initIndex||0,this.fixPage=void 0===s.fixPage?!0:s.fixPage,(this.initIndex>this.data.length-1||this.initIndex<0)&&(this.initIndex=0),this.slideIndex=this.slideIndex||this.initIndex||0,this.axis=this.isVertical?"Y":"X",this.reverseAxis="Y"===this.axis?"X":"Y",this.width=this.wrap.clientWidth,this.height=this.wrap.clientHeight,this.ratio=this.height/this.width,this.scale=this.isVertical?this.height:this.width,this.isLoading=s.isLoading,this.offset=this.offset||{X:0,Y:0},this.data.length<2?(this.isLooping=!1,this.isAutoPlay=!1):(this.isLooping=s.isLooping||!1,this.isAutoplay=s.isAutoplay||!1),"card"===s.animateType&&this.isVertical&&(this.isOverspread=!0),this.log=s.isDebug?function(){t.console.log.apply(t.console,arguments)}:r.EMPTY_FUNCTION,this._setUpDamping(),this._animateFunc=this._animateFuncs[s.animateType in this._animateFuncs?s.animateType:"default"],this.animateTime=null!=s.animateTime&&s.animateTime>-1?s.animateTime:300,this.animateEasing=e(s.animateEasing,r.EASING[0])||r.EASING[1].test(s.animateEasing)?s.animateEasing:"ease",this.inAnimate=0,this.deviceEvents=function(){var e=!!("ontouchstart"in t||t.DocumentTouch&&document instanceof t.DocumentTouch);return{hasTouch:e,startEvt:e?"touchstart":"mousedown",moveEvt:e?"touchmove":"mousemove",endEvt:e?"touchend":"mouseup"}}(),this.events={},this.on("slide",s.onslide),this.on("slideStart",s.onslidestart),this.on("slideEnd",s.onslideend),this.on("slideChange",s.onslidechange),this.on("slideChanged",s.onslidechanged),this.on("slideRestore",s.onsliderestore),this.on("slideRestored",s.onsliderestored),this.pluginConfig=function(){if(i(s.plugins)){var t={};return s.plugins.forEach(function(e){i(e)?t[e[0]]=e.slice(1):"string"==typeof e&&(t[e]=[])}),t}return{}}(),this.isAutoplay&&this.play()},o._initPlugins=function(){var t=this.pluginConfig,e=this._plugins;for(var i in t)t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&(this.log("[INIT PLUGIN]:",i,e[i]),e[i]&&"function"==typeof e[i]&&typeof e[i].apply&&e[i].apply(this,t[i]))},o._setUpDamping=function(){var t=this.scale>>1,e=t>>1,i=e>>2;this._damping=function(s){var n,a=Math.abs(s);return n=t>a?a>>1:t+e>a?e+(a-t>>2):e+i+(a-t-e>>3),s>0?n:-n}},o._itemType=function(t){var e=this.data[t].content;return null==e?"empty":Boolean(e.nodeName)&&Boolean(e.nodeType)?"node":"string"==typeof e?h(e)?"pic":"html":"unknown"},o._renderItem=function(t,e){var i,s,n=this.data.length,a=function(){s=i.height/i.width>this.ratio?'':'',t.innerHTML=s}.bind(this);if(t.innerHTML="",t.style.background="",this.isLooping||null!=this.data[e]){e=(n+e)%n,i=this.data[e];var h=null!=this.type?this.type:i.type||(i.type=this._itemType(e));switch(this.log("[Render ITEM]:",h,e,i),t.className="islider-"+h,h){case"pic":if(this.isOverspread)t.style.background="url("+i.content+") no-repeat 50% 50%/cover";else if(i.height&&i.width)a();else{var r=new Image;r.src=i.content,r.onload=function(){i.height=r.height,i.width=r.width,a()}}break;case"dom":case"html":t.innerHTML=i.content;break;case"node":case"element":if(11===i.content.nodeType){var o=document.createElement("div");o.appendChild(i.content),i.content=o}t.appendChild(i.content)}}},o._renderIntermediateScene=function(){null!=this._intermediateScene&&(this._renderItem.apply(this,this._intermediateScene),this._intermediateScene=null)},o._changedStyles=function(){var t=["islider-prev","islider-active","islider-next"];this.els.forEach(function(e,i){a(e,"("+t.join("|")+")"),n(e,t[i])})},o._renderHTML=function(){this.outer&&(this.outer.innerHTML="");var t=this.outer||document.createElement("ul");if(t.className="islider-outer","pic"===this.type&&!this.loader&&this.isLoading){var e=document.createElement("div");e.className="islider-loader",this.loader=e,this.wrap.appendChild(e),this.fire("loading")}this.els=[];for(var i=0;3>i;i++){var s=document.createElement("li");this.els.push(s),this._animateFunc(s,this.axis,this.scale,i,0),!this.isVertical||"rotate"!==this._opts.animateType&&"flip"!==this._opts.animateType?this._renderItem(s,i-1+this.slideIndex):this._renderItem(s,1-i+this.slideIndex),t.appendChild(s)}this._changedStyles(),this._initLoadImg(),this.outer||(this.outer=t,this.wrap.appendChild(t))},o._preloadImg=function(t){if("pic"===this.type&&this.data.length>3){var e=this.data,i=e.length,s=function(t){if(t>-1&&"pic"===e[t].type&&!e[t].loaded){var i=new Image;i.src=e[t].content,i.onload=function(){e[t].width=i.width,e[t].height=i.height},e[t].loaded=1}};s(t+2>i-1?(t+2)%i:t+2),s(0>t-2?i-2+t:t-2)}},o._initLoadImg=function(){var t=this.data,e=t.length,i=this.slideIndex,s=this;if("pic"===this.type&&e>3){var n=i+2>e?(i+1)%e:i+1,a=0>i-1?e-1+i:i-1;t[i].loaded=1,t[n].loaded=1,s.isLooping&&(t[a].loaded=1),setTimeout(function(){s._preloadImg(i)},200)}},o._watchTransitionEnd=function(e,i){function s(){a&&t.clearTimeout(a),h.inAnimate--,h.log("Event:","watchTransitionEnd::stuck::release",h.inAnimate),0===h.inAnimate&&("slideChanged"===i&&h._changedStyles(),h.fire.apply(h,o),h._renderIntermediateScene()),n()}function n(){h.els.forEach(function(t){t.removeEventListener(r._transitionEndEvent(),s)}),h.isAnimating=!1}var a,h=this,o=Array.prototype.slice.call(arguments,1);this.log("Event:","watchTransitionEnd::stuck::pile",this.inAnimate),e>0&&h.els.forEach(function(t){t.addEventListener(r._transitionEndEvent(),s)}),a=t.setTimeout(s,e),h.inAnimate++},o._bindHandler=function(){var e=this.outer,i=this.deviceEvents;i.hasTouch||(e.style.cursor="pointer",e.ondragstart=function(t){return t?!1:!0}),e.addEventListener(i.startEvt,this),e.addEventListener(i.moveEvt,this),e.addEventListener(i.endEvt,this),t.addEventListener("orientationchange",this),t.addEventListener("focus",this,!1),t.addEventListener("blur",this,!1)},o.handleEvent=function(t){var e=this.deviceEvents;switch(t.type){case e.startEvt:this.startHandler(t);break;case e.moveEvt:this.moveHandler(t);break;case e.endEvt:this.endHandler(t);break;case"touchcancel":this.endHandler(t);break;case"orientationchange":this.orientationchangeHandler();break;case"focus":this.isAutoplay&&this.play();break;case"blur":this.pause()}},o.startHandler=function(t){if(this.fixPage){var e=t.target,i=["SELECT","INPUT","TEXTAREA","BUTTON","LABEL"];i.indexOf(e.tagName)<0&&t.preventDefault()}if(!this.holding&&!this.locking){var s=this.deviceEvents;this.isMoving=!0,this.pause(),this.log("Event: start"),this.fire("slideStart",t,this),this.startTime=(new Date).getTime(),this.startX=s.hasTouch?t.targetTouches[0].pageX:t.pageX,this.startY=s.hasTouch?t.targetTouches[0].pageY:t.pageY}},o.moveHandler=function(t){if(this.isMoving){this.log("Event: moving");var e=this.deviceEvents,i=this.data.length,s=this.axis,n=this.reverseAxis,a={X:e.hasTouch?t.targetTouches[0].pageX-this.startX:t.pageX-this.startX,Y:e.hasTouch?t.targetTouches[0].pageY-this.startY:t.pageY-this.startY};if(this.offset=a,Math.abs(a[s])-Math.abs(a[n])>10){t.preventDefault(),this.fire("slide",t,this),this.isLooping||(a[s]>0&&0===this.slideIndex||a[s]<0&&this.slideIndex===i-1)&&(a[s]=this._damping(a[s]));for(var h=0;3>h;h++){var r=this.els[h];r.style.webkitTransition="all 0s",this._animateFunc(r,s,this.scale,h,a[s])}}}},o.endHandler=function(e){if(this.isMoving){this.log("Event: end"),this.isMoving=!1;var i=this.offset,s=this.axis,n=this.scale/2,a=(new Date).getTime();n=a-this.startTime>300?n:14;var h=Math.abs(i[s]),r=Math.abs(i[this.reverseAxis]),o=function(e){if("A"===e.tagName){if(e.href)return t.location.href=e.href,!1}else{if("islider-pic"!==e.className)return!1;o(e.parentNode)}};this.log(n,i[s],h,r,this),this.slideTo(i[s]>=n&&h>r?this.slideIndex-1:i[s]<-n&&h>r?this.slideIndex+1:this.slideIndex),Math.abs(this.offset.X)<10&&Math.abs(this.offset.Y)<10&&(this.tapEvt=document.createEvent("Event"),this.tapEvt.initEvent("tap",!0,!0),this.fixPage&&e.target&&o(e.target),e.target.dispatchEvent(this.tapEvt)||e.preventDefault()),this.offset.X=this.offset.Y=0,this.isAutoplay&&this.play(),this.fire("slideEnd",e,this)}},o.orientationchangeHandler=function(){setTimeout(function(){this.reset(),this.log("Event: orientationchange")}.bind(this),100)},o.slideTo=function(t,e){if(!this.locking){this.unhold();var i,s=this.animateTime,n=this._opts.animateType,a=this._animateFunc,h=this.data,r=this.els,o=t,l=t-this.slideIndex,d=this.offset;"object"==typeof e&&(e.animateTime>-1&&(s=e.animateTime),"string"==typeof e.animateType&&e.animateType in this._animateFuncs&&(n=e.animateType,a=this._animateFuncs[n]));var c=Math.abs(d[this.axis])/this.scale*s;Math.abs(l)>1&&this._renderItem(l>0?this.els[2]:this.els[0],o),this._preloadImg(o),h[o]?this.slideIndex=o:this.isLooping?this.slideIndex=l>0?0:h.length-1:(this.slideIndex=this.slideIndex,l=0),this.log("Index:"+this.slideIndex);var u,p;if(0===l)i="slideRestore";else{var f=(this.isVertical&&("rotate"===n||"flip"===n))^l>0;f?(r.push(r.shift()),u=r[2],p=r[0]):(r.unshift(r.pop()),u=r[0],p=r[2]),1===Math.abs(l)?(this._renderIntermediateScene(),this._renderItem(u,o+l)):Math.abs(l)>1&&(this._renderItem(u,o+(f?1:-1)),this._intermediateScene=[p,o+(f?-1:1)]),u.style.webkitTransition="none",u.style.visibility="hidden",setTimeout(function(){u.style.visibility="visible"},200),c=s-c,i="slideChange"}this.fire(i,this.slideIndex,r[1],this),this._watchTransitionEnd(c,i+"d",this.slideIndex,r[1],this);for(var g=0;3>g;g++)r[g]!==u&&(r[g].style.webkitTransition="all "+c/1e3+"s "+this.animateEasing),a.call(this,r[g],this.axis,this.scale,g,0);this.isAutoplay&&!this.isLooping&&this.slideIndex===h.length-1&&this.pause()}},o.slideNext=function(){this.slideTo.apply(this,[this.slideIndex+1].concat(Array.prototype.slice.call(arguments)))},o.slidePrev=function(){this.slideTo.apply(this,[this.slideIndex-1].concat(Array.prototype.slice.call(arguments)))},o.regPlugin=function(){var t=Array.prototype.slice.call(arguments),i=t.shift(),s=t[0];(this._plugins.hasOwnProperty(i)||"function"==typeof s)&&("function"==typeof s&&(this._plugins[i]=s,t.shift()),e(i,this._opts.plugins)||(this._opts.plugins.push(t.length?[].concat([i],t):i),"function"==typeof this._plugins[i]&&this._plugins[i].apply(this,t)))},o.bind=o.delegate=function(e,i,s){function n(e){for(var n=t.event?t.event:e,a=n.target,h=document.querySelectorAll(i),r=0;r-1&&delete i[s]}},o.fire=function(t){if(this.log("[EVENT FIRE]:",t,arguments),t in this.events)for(var e=this.events[t],i=0;i li { + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + list-style: none; + overflow: hidden; display: -webkit-box; -webkit-box-pack: center; + box-pack: center; -webkit-box-align: center; - list-style: none; + box-align: center; } .islider-img > img { @@ -36,7 +41,7 @@ bottom: 0; margin: auto 0; display: block; - background-color: rgb(119, 119, 119); + background-color: #777777; } .islider-btn-outer.left { @@ -51,12 +56,8 @@ position: absolute; width: 50%; height: 50%; - border-top-width: 2px; - border-top-style: solid; - border-top-color: rgb(255, 255, 255); - border-left-width: 2px; - border-left-style: solid; - border-left-color: rgb(255, 255, 255); + border-top: 2px solid #ffffff; + border-left: 2px solid #ffffff; margin: auto; top: 0; bottom: 0; @@ -66,10 +67,12 @@ .islider-btn-outer.left > .islider-btn-inner { -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); } .islider-btn-outer.right > .islider-btn-inner { -webkit-transform: rotate(135deg); + transform: rotate(135deg); } .islider-dot-wrap { @@ -91,13 +94,13 @@ width: 0.8em; height: 0.8em; border-radius: 50%; - border: 1px solid rgb(255, 255, 255); + border: 1px solid #ffffff; list-style-type: none; margin: 5px; } .islider-dot.active { - background-color: #fff; + background-color: #ffffff; } .islider-loader { diff --git a/demo/public/js/iSlider.js b/demo/public/js/iSlider.js index f9b3511a..d909276e 100644 --- a/demo/public/js/iSlider.js +++ b/demo/public/js/iSlider.js @@ -136,7 +136,7 @@ * @type {Array} * @protected */ - iSlider.EVENTS = 'slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored destroy'.split(' '); + iSlider.EVENTS = 'slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored reloadData destroy'.split(' '); /** * Easing white list @@ -649,22 +649,20 @@ // initail ul element var outer = this.outer || document.createElement('ul'); outer.className = 'islider-outer'; - outer.style.cssText = 'height:' + this.height + 'px;width:' + this.width + 'px;margin:0;padding:0;list-style:none;'; - //loading + // loading if (this.type === 'pic' && !this.loader && this.isLoading) { var loader = document.createElement('div'); loader.className = 'islider-loader'; this.loader = loader; this.wrap.appendChild(loader); + this.fire('loading'); } // storage li elements, only store 3 elements to reduce memory usage this.els = []; for (var i = 0; i < 3; i++) { var li = document.createElement('li'); - // li.className = this.type === 'dom' ? 'islider-dom' : 'islider-pic'; - li.style.cssText = 'height:' + this.height + 'px;width:' + this.width + 'px;'; this.els.push(li); // prepare style animation @@ -1268,7 +1266,7 @@ this.slideIndex = initIndex || 0; this.data = data; this._renderHTML(); - this._initPlugins(); + this.fire('reloadData'); this.isAutoplay && this.play(); }; diff --git a/demo/public/js/iSlider.plugin.dot.js b/demo/public/js/iSlider.plugin.dot.js index 853a1d2f..a7ab0672 100644 --- a/demo/public/js/iSlider.plugin.dot.js +++ b/demo/public/js/iSlider.plugin.dot.js @@ -31,21 +31,27 @@ var dots = []; var dotWrap = document.createElement('ul'); dotWrap.className = 'islider-dot-wrap'; - var fregment = document.createDocumentFragment(); - for (var i = 0; i < data.length; i++) { - dots[i] = document.createElement('li'); - dots[i].className = 'islider-dot'; - dots[i].setAttribute('index', i); - if (i === HANDLE.slideIndex) { - dots[i].className += ' active'; + + var renderDots = function renderDots() { + var fregment = document.createDocumentFragment(); + for (var i = 0; i < data.length; i++) { + dots[i] = document.createElement('li'); + dots[i].className = 'islider-dot'; + dots[i].setAttribute('index', i); + if (i === HANDLE.slideIndex) { + dots[i].className += ' active'; + } + dots[i].onclick = function () { + HANDLE.slideTo(parseInt(this.getAttribute('index'), 10)); + }; + fregment.appendChild(dots[i]); } - dots[i].addEventListener('click', function () { - var index = parseInt(this.getAttribute('index'), 10); - HANDLE.slideTo(index); - }); - fregment.appendChild(dots[i]); - } - dotWrap.appendChild(fregment); + dotWrap.innerHTML = ''; + dotWrap.appendChild(fregment); + }; + + renderDots(); + HANDLE.wrap.parentNode.appendChild(dotWrap); HANDLE.on('slideChange', function () { @@ -58,6 +64,12 @@ } } }); + + HANDLE.on('reloadData', function () { + data = this.data; + dots = []; + renderDots(); + }); } }); }); diff --git a/src/index.html b/src/index.html index 76b2e4cf..0e8c903c 100644 --- a/src/index.html +++ b/src/index.html @@ -11,44 +11,6 @@ background: #333; overflow: hidden; } - - /*ul wrapper*/ - #iSlider-wrapper { - height: 100%; - width: 100%; - overflow: hidden; - position: absolute; - } - - #iSlider-wrapper ul { - list-style: none; - margin: 0; - padding: 0; - height: 100%; - overflow: hidden; - } - - #iSlider-wrapper li { - position: absolute; - margin: 0; - padding: 0; - height: 100%; - overflow: hidden; - display: -webkit-box; - -webkit-box-pack: center; - -webkit-box-align: center; - list-style: none; - } - - #iSlider-wrapper li img { - max-width: 100%; - max-height: 100%; - } - - .islider-btn-outer { - z-index: 10000; - } - @@ -94,8 +56,6 @@ })() }); - // var islider = new iSlider(document.getElementById("iSlider-wrapper")); - var islider = new iSlider({ // type: 'pic', data: list, @@ -103,7 +63,7 @@ // isVertical: true, isLooping: 1, isOverspread: 1, - animateType: 'fade', + animateType: 'default', animateTime: 500, fixPage: 1, isDebug: 1, diff --git a/src/js/iSlider.js b/src/js/iSlider.js index f252527b..d909276e 100644 --- a/src/js/iSlider.js +++ b/src/js/iSlider.js @@ -649,22 +649,20 @@ // initail ul element var outer = this.outer || document.createElement('ul'); outer.className = 'islider-outer'; - outer.style.cssText = 'height:' + this.height + 'px;width:' + this.width + 'px;margin:0;padding:0;list-style:none;'; - //loading + // loading if (this.type === 'pic' && !this.loader && this.isLoading) { var loader = document.createElement('div'); loader.className = 'islider-loader'; this.loader = loader; this.wrap.appendChild(loader); + this.fire('loading'); } // storage li elements, only store 3 elements to reduce memory usage this.els = []; for (var i = 0; i < 3; i++) { var li = document.createElement('li'); - // li.className = this.type === 'dom' ? 'islider-dom' : 'islider-pic'; - li.style.cssText = 'height:' + this.height + 'px;width:' + this.width + 'px;'; this.els.push(li); // prepare style animation diff --git a/src/style/iSlider.css b/src/style/iSlider.css index dacf13f7..b16cf947 100755 --- a/src/style/iSlider.css +++ b/src/style/iSlider.css @@ -1,25 +1,30 @@ /** * @file iSlider.css */ -.islider-pic, -.islider-dom, -.islider-node, -.islider-html, -.islider-element { - position: absolute; +.islider-outer { + display: block; + list-style: none; margin: 0; padding: 0; - top: 0; - left: 0; height: 100%; overflow: hidden; } -.islider-pic { +.islider-outer > li { + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + list-style: none; + overflow: hidden; display: -webkit-box; -webkit-box-pack: center; + box-pack: center; -webkit-box-align: center; - list-style: none; + box-align: center; } .islider-img > img { @@ -36,7 +41,7 @@ bottom: 0; margin: auto 0; display: block; - background-color: rgb(119, 119, 119); + background-color: #777777; } .islider-btn-outer.left { @@ -51,12 +56,8 @@ position: absolute; width: 50%; height: 50%; - border-top-width: 2px; - border-top-style: solid; - border-top-color: rgb(255, 255, 255); - border-left-width: 2px; - border-left-style: solid; - border-left-color: rgb(255, 255, 255); + border-top: 2px solid #ffffff; + border-left: 2px solid #ffffff; margin: auto; top: 0; bottom: 0; @@ -66,10 +67,12 @@ .islider-btn-outer.left > .islider-btn-inner { -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); } .islider-btn-outer.right > .islider-btn-inner { -webkit-transform: rotate(135deg); + transform: rotate(135deg); } .islider-dot-wrap { @@ -91,13 +94,13 @@ width: 0.8em; height: 0.8em; border-radius: 50%; - border: 1px solid rgb(255, 255, 255); + border: 1px solid #ffffff; list-style-type: none; margin: 5px; } .islider-dot.active { - background-color: #fff; + background-color: #ffffff; } .islider-loader { From e3041ea2d11d64daa8c63a3f8cba935fcb52a970 Mon Sep 17 00:00:00 2001 From: shinate Date: Thu, 24 Sep 2015 20:55:05 +0800 Subject: [PATCH 06/18] Optimized code, Perfection Comment --- build/iSlider.js | 207 +++++++++++++++++++++++++++++--------- build/iSlider.min.js | 2 +- demo/public/js/iSlider.js | 207 +++++++++++++++++++++++++++++--------- src/index.html | 4 +- src/js/iSlider.js | 207 +++++++++++++++++++++++++++++--------- 5 files changed, 480 insertions(+), 147 deletions(-) diff --git a/build/iSlider.js b/build/iSlider.js index d909276e..ba768b94 100644 --- a/build/iSlider.js +++ b/build/iSlider.js @@ -125,6 +125,13 @@ */ this._opts = opts; + /** + * listener + * @type {{}} + * @private + */ + this._LSN = {}; + this._setting(); this._renderHTML(); this._initPlugins(); @@ -290,64 +297,137 @@ var opts = this._opts; - // dom element wrapping content + /** + * dom element wrapping content + * @type {Element} + * @public + */ this.wrap = opts.dom; - // your data + /** + * Data list + * @type {Array} + * @public + */ this.data = opts.data; // default type + // TODO will be renamed this.type = opts.type || null; - // default slide direction + /** + * default slide direction + * @type {boolean} + * @public + */ this.isVertical = opts.isVertical || false; - // Overspread mode + /** + * Overspread mode + * @type {boolean} + * @public + */ this.isOverspread = opts.isOverspread || false; - // Play time gap + /** + * Play time gap + * @type {number} + * @public + */ this.duration = opts.duration || 2000; - // start from initIndex or 0 + /** + * start from initIndex or 0 + * @type {number} + * @public + */ this.initIndex = opts.initIndex || 0; - // touchstart prevent default to fixPage - if (opts.fixPage === undefined) { - this.fixPage = true; - } - else { - this.fixPage = opts.fixPage; - } + /** + * touchstart prevent default to fixPage + * @type {boolean} + * @public + */ + this.fixPage = opts.fixPage || true; - // TODO - // in looping mode, will support index overflow + // When initIndex overflow + // TODO in looping mode, will support index overflow if (this.initIndex > this.data.length - 1 || this.initIndex < 0) { this.initIndex = 0; } + /** + * slideIndex + * @type {number} + * @private + */ this.slideIndex = this.slideIndex || this.initIndex || 0; + /** + * Axis + * @type {string} + * @public + */ this.axis = this.isVertical ? 'Y' : 'X'; + + /** + * reverseAxis + * @type {string} + * @private + */ this.reverseAxis = this.axis === 'Y' ? 'X' : 'Y'; + /** + * Wrapper width + * @type {number} + * @private + */ this.width = this.wrap.clientWidth; + + /** + * Wrapper height + * @type {number} + * @private + */ this.height = this.wrap.clientHeight; + + /** + * Ratio height:width + * @type {number} + * @private + */ this.ratio = this.height / this.width; + + /** + * Scale, size rule + * @type {number} + * @private + */ this.scale = this.isVertical ? this.height : this.width; + // TODO will be removed this.isLoading = opts.isLoading; + /** + * On slide offset position + * @type {{X: number, Y: number}} + * @private + */ this.offset = this.offset || {X: 0, Y: 0}; - // looping logic adjust - if (this.data.length < 2) { - this.isLooping = false; - this.isAutoPlay = false; - } - else { - this.isLooping = opts.isLooping || false; - this.isAutoplay = opts.isAutoplay || false; - } + /** + * looping logic adjust + * @type {boolean} + * @private + */ + this.isLooping = this.data.length > 1 && opts.isLooping ? true : false; + + /** + * autoplay logic adjust + * @type {boolean} + * @private + */ + this.isAutoplay = this.data.length > 1 && opts.isAutoplay ? true : false; // little trick set, when you chooce tear & vertical same time // iSlider overspread mode will be set true autometicly @@ -355,7 +435,11 @@ this.isOverspread = true; } - // debug mode + /** + * Debug mode + * @type {function} + * @private + */ this.log = opts.isDebug ? function () { global.console.log.apply(global.console, arguments); } : iSlider.EMPTY_FUNCTION; @@ -371,21 +455,35 @@ */ this._animateFunc = this._animateFuncs[opts.animateType in this._animateFuncs ? opts.animateType : 'default']; - // set animate process time (ms), default: 300ms + /** + * animate process time (ms), default: 300ms + * @type {number} + * @public + */ this.animateTime = opts.animateTime != null && opts.animateTime > -1 ? opts.animateTime : 300; - // set animate effects, default: ease + /** + * animate effects, default: ease + * @type {string} + * @public + */ this.animateEasing = inArray(opts.animateEasing, iSlider.EASING[0]) || iSlider.EASING[1].test(opts.animateEasing) ? opts.animateEasing : 'ease'; + /** + * In slide animation + * @type {number} + * @private + */ this.inAnimate = 0; /** * Fix touch/mouse events * @type {{hasTouch, startEvt, moveEvt, endEvt}} + * @private */ this.deviceEvents = (function () { var hasTouch = !!(('ontouchstart' in global) || global.DocumentTouch && document instanceof global.DocumentTouch); @@ -567,7 +665,7 @@ item = this.data[dataIndex]; } - var type = this.type != null ? this.type : item.type || (item.type = this._itemType(dataIndex)); + var type = item.type || (item.type = this._itemType(dataIndex)); this.log('[Render ITEM]:', type, dataIndex, item); @@ -731,7 +829,7 @@ data[prevIndex].loaded = 1; } - setTimeout(function () { + global.setTimeout(function () { self._preloadImg(idx); }, 200); } @@ -803,6 +901,7 @@ outer.addEventListener(device.endEvt, this); global.addEventListener('orientationchange', this); + global.addEventListener('resize', this); // Fix android device global.addEventListener('focus', this, false); @@ -839,6 +938,9 @@ case 'blur': this.pause(); break; + case 'resize': + this.resizeHandler(); + break; } }; @@ -984,12 +1086,27 @@ * @protected */ iSliderPrototype.orientationchangeHandler = function () { - setTimeout(function () { + global.setTimeout(function () { this.reset(); this.log('Event: orientationchange'); }.bind(this), 100); }; + /** + * resize callback + * @protected + */ + iSliderPrototype.resizeHandler = function () { + if (this.height !== this.wrap.clientHeight || this.width !== this.wrap.clientWidth) { + this._LSN.resize && global.clearTimeout(this._LSN.resize); + this._LSN.resize = global.setTimeout(function () { + this.reset(); + this.log('Event: resize'); + this._LSN.resize && global.clearTimeout(this._LSN.resize); + }.bind(this), 500); + } + }; + /** * slide logical, goto data index * @param {number} dataIndex the goto index @@ -1047,7 +1164,7 @@ this.log('Index:' + this.slideIndex); // keep the right order of items - var headEl, tailEl; + var headEl, tailEl, step; // slidechange should render new item // and change new item style to fit animation @@ -1055,38 +1172,33 @@ // Restore to current scene eventType = 'slideRestore'; } else { - // TODO - var ori = (this.isVertical && (animateType === 'rotate' || animateType === 'flip')) ^ (n > 0) - if (ori) { + + if ((this.isVertical && (animateType === 'rotate' || animateType === 'flip')) ^ (n > 0)) { els.push(els.shift()); headEl = els[2]; tailEl = els[0]; + step = 1; } else { els.unshift(els.pop()); headEl = els[0]; tailEl = els[2]; + step = -1; } - // slide to next/prev scenes - //if (Math.abs(n) > 1) { - // this._renderItem(els[0], idx - 1); - // this._renderItem(els[2], idx + 1); - //} - //else + if (Math.abs(n) === 1) { this._renderIntermediateScene(); this._renderItem(headEl, idx + n); } else if (Math.abs(n) > 1) { - // this._renderItem(els[n < 0 ? 0 : 2], idx + n + (n < 0 ? -1 : 1)); - this._renderItem(headEl, idx + (ori ? 1 : -1)); - this._intermediateScene = [tailEl, idx + (ori ? -1 : 1)]; + this._renderItem(headEl, idx + step); + this._intermediateScene = [tailEl, idx - step]; } + headEl.style.webkitTransition = 'none'; headEl.style.visibility = 'hidden'; - // TODO - // ??? - setTimeout(function () { + // TODO ??? + global.setTimeout(function () { headEl.style.visibility = 'visible'; }, 200); @@ -1237,8 +1349,7 @@ if (eventName in this.events) { var funcs = this.events[eventName]; for (var i = 0; i < funcs.length; i++) { - // TODO - // will support custom context, now context is instance of iSlider + // TODO will support custom context, now context is instance of iSlider typeof funcs[i] === 'function' && funcs[i].apply && funcs[i].apply(this, Array.prototype.slice.call(arguments, 1)); diff --git a/build/iSlider.min.js b/build/iSlider.min.js index fd41bae2..80d94b42 100644 --- a/build/iSlider.min.js +++ b/build/iSlider.min.js @@ -1 +1 @@ -!function(t){"use strict";function e(t,e){return e.indexOf(t)>-1}function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t,e){return t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function n(t,e){s(t,e)||(t.className+=" "+e)}function a(t,e){s(t,e)&&(t.className=t.className.replace(RegExp("(\\s|^)"+e+"(\\s|$)"),""))}function h(t){if(/<\/?[^>]*>/g.test(t))return!1;var e="^(((https|http|ftp|rtsp|mms):)?//)?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})?(:[0-9]{1,4})?([^?#]+)?(\\?[^#]+)?(#.+)?$";return new RegExp(e).test(t)}var r=function(t){if(!t.dom)throw new Error("Container can not be empty!");if(!t.data||!t.data.length)throw new Error("Data must be an array and must have more than one element!");this._opts=t,this._setting(),this._renderHTML(),this._initPlugins(),this._bindHandler()};r.EVENTS="slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored reloadData destroy".split(" "),r.EASING=["linear ease ease-in ease-out ease-in-out".split(" "),/cubic-bezier\(([^\d]*(\d+.?\d*)[^\,]*\,?){4}\)/],r.EMPTY_FUNCTION=function(){},r.extend=function(){if(arguments.length){var t,e;switch(arguments.length){case 1:t=r.prototype,e=arguments[0];break;case 2:t=arguments[0],e=arguments[1]}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}},r.plugins={},r.regPlugin=function(t,e){r.plugins[t]=r.plugins[t]||e},r._animateFuncs={"default":function(t,e,i,s,n){t.style.webkitTransform="translateZ(0) translate"+e+"("+(n+i*(s-1))+"px)"}},r._transitionEndEvent=function(){var t;return function(){if(t)return t;var e=document.createElement("fakeElement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(var s in i)if(i.hasOwnProperty(s)&&void 0!==e.style[s])return t=i[s]}}();var o=r.prototype;o.extend=r.extend,o._setting=function(){this._plugins=r.plugins,this._animateFuncs=r._animateFuncs,this.holding=!1,this.locking=!1;var s=this._opts;this.wrap=s.dom,this.data=s.data,this.type=s.type||null,this.isVertical=s.isVertical||!1,this.isOverspread=s.isOverspread||!1,this.duration=s.duration||2e3,this.initIndex=s.initIndex||0,this.fixPage=void 0===s.fixPage?!0:s.fixPage,(this.initIndex>this.data.length-1||this.initIndex<0)&&(this.initIndex=0),this.slideIndex=this.slideIndex||this.initIndex||0,this.axis=this.isVertical?"Y":"X",this.reverseAxis="Y"===this.axis?"X":"Y",this.width=this.wrap.clientWidth,this.height=this.wrap.clientHeight,this.ratio=this.height/this.width,this.scale=this.isVertical?this.height:this.width,this.isLoading=s.isLoading,this.offset=this.offset||{X:0,Y:0},this.data.length<2?(this.isLooping=!1,this.isAutoPlay=!1):(this.isLooping=s.isLooping||!1,this.isAutoplay=s.isAutoplay||!1),"card"===s.animateType&&this.isVertical&&(this.isOverspread=!0),this.log=s.isDebug?function(){t.console.log.apply(t.console,arguments)}:r.EMPTY_FUNCTION,this._setUpDamping(),this._animateFunc=this._animateFuncs[s.animateType in this._animateFuncs?s.animateType:"default"],this.animateTime=null!=s.animateTime&&s.animateTime>-1?s.animateTime:300,this.animateEasing=e(s.animateEasing,r.EASING[0])||r.EASING[1].test(s.animateEasing)?s.animateEasing:"ease",this.inAnimate=0,this.deviceEvents=function(){var e=!!("ontouchstart"in t||t.DocumentTouch&&document instanceof t.DocumentTouch);return{hasTouch:e,startEvt:e?"touchstart":"mousedown",moveEvt:e?"touchmove":"mousemove",endEvt:e?"touchend":"mouseup"}}(),this.events={},this.on("slide",s.onslide),this.on("slideStart",s.onslidestart),this.on("slideEnd",s.onslideend),this.on("slideChange",s.onslidechange),this.on("slideChanged",s.onslidechanged),this.on("slideRestore",s.onsliderestore),this.on("slideRestored",s.onsliderestored),this.pluginConfig=function(){if(i(s.plugins)){var t={};return s.plugins.forEach(function(e){i(e)?t[e[0]]=e.slice(1):"string"==typeof e&&(t[e]=[])}),t}return{}}(),this.isAutoplay&&this.play()},o._initPlugins=function(){var t=this.pluginConfig,e=this._plugins;for(var i in t)t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&(this.log("[INIT PLUGIN]:",i,e[i]),e[i]&&"function"==typeof e[i]&&typeof e[i].apply&&e[i].apply(this,t[i]))},o._setUpDamping=function(){var t=this.scale>>1,e=t>>1,i=e>>2;this._damping=function(s){var n,a=Math.abs(s);return n=t>a?a>>1:t+e>a?e+(a-t>>2):e+i+(a-t-e>>3),s>0?n:-n}},o._itemType=function(t){var e=this.data[t].content;return null==e?"empty":Boolean(e.nodeName)&&Boolean(e.nodeType)?"node":"string"==typeof e?h(e)?"pic":"html":"unknown"},o._renderItem=function(t,e){var i,s,n=this.data.length,a=function(){s=i.height/i.width>this.ratio?'':'',t.innerHTML=s}.bind(this);if(t.innerHTML="",t.style.background="",this.isLooping||null!=this.data[e]){e=(n+e)%n,i=this.data[e];var h=null!=this.type?this.type:i.type||(i.type=this._itemType(e));switch(this.log("[Render ITEM]:",h,e,i),t.className="islider-"+h,h){case"pic":if(this.isOverspread)t.style.background="url("+i.content+") no-repeat 50% 50%/cover";else if(i.height&&i.width)a();else{var r=new Image;r.src=i.content,r.onload=function(){i.height=r.height,i.width=r.width,a()}}break;case"dom":case"html":t.innerHTML=i.content;break;case"node":case"element":if(11===i.content.nodeType){var o=document.createElement("div");o.appendChild(i.content),i.content=o}t.appendChild(i.content)}}},o._renderIntermediateScene=function(){null!=this._intermediateScene&&(this._renderItem.apply(this,this._intermediateScene),this._intermediateScene=null)},o._changedStyles=function(){var t=["islider-prev","islider-active","islider-next"];this.els.forEach(function(e,i){a(e,"("+t.join("|")+")"),n(e,t[i])})},o._renderHTML=function(){this.outer&&(this.outer.innerHTML="");var t=this.outer||document.createElement("ul");if(t.className="islider-outer","pic"===this.type&&!this.loader&&this.isLoading){var e=document.createElement("div");e.className="islider-loader",this.loader=e,this.wrap.appendChild(e),this.fire("loading")}this.els=[];for(var i=0;3>i;i++){var s=document.createElement("li");this.els.push(s),this._animateFunc(s,this.axis,this.scale,i,0),!this.isVertical||"rotate"!==this._opts.animateType&&"flip"!==this._opts.animateType?this._renderItem(s,i-1+this.slideIndex):this._renderItem(s,1-i+this.slideIndex),t.appendChild(s)}this._changedStyles(),this._initLoadImg(),this.outer||(this.outer=t,this.wrap.appendChild(t))},o._preloadImg=function(t){if("pic"===this.type&&this.data.length>3){var e=this.data,i=e.length,s=function(t){if(t>-1&&"pic"===e[t].type&&!e[t].loaded){var i=new Image;i.src=e[t].content,i.onload=function(){e[t].width=i.width,e[t].height=i.height},e[t].loaded=1}};s(t+2>i-1?(t+2)%i:t+2),s(0>t-2?i-2+t:t-2)}},o._initLoadImg=function(){var t=this.data,e=t.length,i=this.slideIndex,s=this;if("pic"===this.type&&e>3){var n=i+2>e?(i+1)%e:i+1,a=0>i-1?e-1+i:i-1;t[i].loaded=1,t[n].loaded=1,s.isLooping&&(t[a].loaded=1),setTimeout(function(){s._preloadImg(i)},200)}},o._watchTransitionEnd=function(e,i){function s(){a&&t.clearTimeout(a),h.inAnimate--,h.log("Event:","watchTransitionEnd::stuck::release",h.inAnimate),0===h.inAnimate&&("slideChanged"===i&&h._changedStyles(),h.fire.apply(h,o),h._renderIntermediateScene()),n()}function n(){h.els.forEach(function(t){t.removeEventListener(r._transitionEndEvent(),s)}),h.isAnimating=!1}var a,h=this,o=Array.prototype.slice.call(arguments,1);this.log("Event:","watchTransitionEnd::stuck::pile",this.inAnimate),e>0&&h.els.forEach(function(t){t.addEventListener(r._transitionEndEvent(),s)}),a=t.setTimeout(s,e),h.inAnimate++},o._bindHandler=function(){var e=this.outer,i=this.deviceEvents;i.hasTouch||(e.style.cursor="pointer",e.ondragstart=function(t){return t?!1:!0}),e.addEventListener(i.startEvt,this),e.addEventListener(i.moveEvt,this),e.addEventListener(i.endEvt,this),t.addEventListener("orientationchange",this),t.addEventListener("focus",this,!1),t.addEventListener("blur",this,!1)},o.handleEvent=function(t){var e=this.deviceEvents;switch(t.type){case e.startEvt:this.startHandler(t);break;case e.moveEvt:this.moveHandler(t);break;case e.endEvt:this.endHandler(t);break;case"touchcancel":this.endHandler(t);break;case"orientationchange":this.orientationchangeHandler();break;case"focus":this.isAutoplay&&this.play();break;case"blur":this.pause()}},o.startHandler=function(t){if(this.fixPage){var e=t.target,i=["SELECT","INPUT","TEXTAREA","BUTTON","LABEL"];i.indexOf(e.tagName)<0&&t.preventDefault()}if(!this.holding&&!this.locking){var s=this.deviceEvents;this.isMoving=!0,this.pause(),this.log("Event: start"),this.fire("slideStart",t,this),this.startTime=(new Date).getTime(),this.startX=s.hasTouch?t.targetTouches[0].pageX:t.pageX,this.startY=s.hasTouch?t.targetTouches[0].pageY:t.pageY}},o.moveHandler=function(t){if(this.isMoving){this.log("Event: moving");var e=this.deviceEvents,i=this.data.length,s=this.axis,n=this.reverseAxis,a={X:e.hasTouch?t.targetTouches[0].pageX-this.startX:t.pageX-this.startX,Y:e.hasTouch?t.targetTouches[0].pageY-this.startY:t.pageY-this.startY};if(this.offset=a,Math.abs(a[s])-Math.abs(a[n])>10){t.preventDefault(),this.fire("slide",t,this),this.isLooping||(a[s]>0&&0===this.slideIndex||a[s]<0&&this.slideIndex===i-1)&&(a[s]=this._damping(a[s]));for(var h=0;3>h;h++){var r=this.els[h];r.style.webkitTransition="all 0s",this._animateFunc(r,s,this.scale,h,a[s])}}}},o.endHandler=function(e){if(this.isMoving){this.log("Event: end"),this.isMoving=!1;var i=this.offset,s=this.axis,n=this.scale/2,a=(new Date).getTime();n=a-this.startTime>300?n:14;var h=Math.abs(i[s]),r=Math.abs(i[this.reverseAxis]),o=function(e){if("A"===e.tagName){if(e.href)return t.location.href=e.href,!1}else{if("islider-pic"!==e.className)return!1;o(e.parentNode)}};this.log(n,i[s],h,r,this),this.slideTo(i[s]>=n&&h>r?this.slideIndex-1:i[s]<-n&&h>r?this.slideIndex+1:this.slideIndex),Math.abs(this.offset.X)<10&&Math.abs(this.offset.Y)<10&&(this.tapEvt=document.createEvent("Event"),this.tapEvt.initEvent("tap",!0,!0),this.fixPage&&e.target&&o(e.target),e.target.dispatchEvent(this.tapEvt)||e.preventDefault()),this.offset.X=this.offset.Y=0,this.isAutoplay&&this.play(),this.fire("slideEnd",e,this)}},o.orientationchangeHandler=function(){setTimeout(function(){this.reset(),this.log("Event: orientationchange")}.bind(this),100)},o.slideTo=function(t,e){if(!this.locking){this.unhold();var i,s=this.animateTime,n=this._opts.animateType,a=this._animateFunc,h=this.data,r=this.els,o=t,l=t-this.slideIndex,d=this.offset;"object"==typeof e&&(e.animateTime>-1&&(s=e.animateTime),"string"==typeof e.animateType&&e.animateType in this._animateFuncs&&(n=e.animateType,a=this._animateFuncs[n]));var c=Math.abs(d[this.axis])/this.scale*s;Math.abs(l)>1&&this._renderItem(l>0?this.els[2]:this.els[0],o),this._preloadImg(o),h[o]?this.slideIndex=o:this.isLooping?this.slideIndex=l>0?0:h.length-1:(this.slideIndex=this.slideIndex,l=0),this.log("Index:"+this.slideIndex);var u,p;if(0===l)i="slideRestore";else{var f=(this.isVertical&&("rotate"===n||"flip"===n))^l>0;f?(r.push(r.shift()),u=r[2],p=r[0]):(r.unshift(r.pop()),u=r[0],p=r[2]),1===Math.abs(l)?(this._renderIntermediateScene(),this._renderItem(u,o+l)):Math.abs(l)>1&&(this._renderItem(u,o+(f?1:-1)),this._intermediateScene=[p,o+(f?-1:1)]),u.style.webkitTransition="none",u.style.visibility="hidden",setTimeout(function(){u.style.visibility="visible"},200),c=s-c,i="slideChange"}this.fire(i,this.slideIndex,r[1],this),this._watchTransitionEnd(c,i+"d",this.slideIndex,r[1],this);for(var g=0;3>g;g++)r[g]!==u&&(r[g].style.webkitTransition="all "+c/1e3+"s "+this.animateEasing),a.call(this,r[g],this.axis,this.scale,g,0);this.isAutoplay&&!this.isLooping&&this.slideIndex===h.length-1&&this.pause()}},o.slideNext=function(){this.slideTo.apply(this,[this.slideIndex+1].concat(Array.prototype.slice.call(arguments)))},o.slidePrev=function(){this.slideTo.apply(this,[this.slideIndex-1].concat(Array.prototype.slice.call(arguments)))},o.regPlugin=function(){var t=Array.prototype.slice.call(arguments),i=t.shift(),s=t[0];(this._plugins.hasOwnProperty(i)||"function"==typeof s)&&("function"==typeof s&&(this._plugins[i]=s,t.shift()),e(i,this._opts.plugins)||(this._opts.plugins.push(t.length?[].concat([i],t):i),"function"==typeof this._plugins[i]&&this._plugins[i].apply(this,t)))},o.bind=o.delegate=function(e,i,s){function n(e){for(var n=t.event?t.event:e,a=n.target,h=document.querySelectorAll(i),r=0;r-1&&delete i[s]}},o.fire=function(t){if(this.log("[EVENT FIRE]:",t,arguments),t in this.events)for(var e=this.events[t],i=0;i-1}function i(t){return"[object Array]"===Object.prototype.toString.call(t)}function s(t,e){return t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function n(t,e){s(t,e)||(t.className+=" "+e)}function a(t,e){s(t,e)&&(t.className=t.className.replace(RegExp("(\\s|^)"+e+"(\\s|$)"),""))}function h(t){if(/<\/?[^>]*>/g.test(t))return!1;var e="^(((https|http|ftp|rtsp|mms):)?//)?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-z_!~*'()-]+.)*([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].[a-z]{2,6})?(:[0-9]{1,4})?([^?#]+)?(\\?[^#]+)?(#.+)?$";return new RegExp(e).test(t)}var r=function(t){if(!t.dom)throw new Error("Container can not be empty!");if(!t.data||!t.data.length)throw new Error("Data must be an array and must have more than one element!");this._opts=t,this._LSN={},this._setting(),this._renderHTML(),this._initPlugins(),this._bindHandler()};r.EVENTS="slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored reloadData destroy".split(" "),r.EASING=["linear ease ease-in ease-out ease-in-out".split(" "),/cubic-bezier\(([^\d]*(\d+.?\d*)[^\,]*\,?){4}\)/],r.EMPTY_FUNCTION=function(){},r.extend=function(){if(arguments.length){var t,e;switch(arguments.length){case 1:t=r.prototype,e=arguments[0];break;case 2:t=arguments[0],e=arguments[1]}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])}},r.plugins={},r.regPlugin=function(t,e){r.plugins[t]=r.plugins[t]||e},r._animateFuncs={"default":function(t,e,i,s,n){t.style.webkitTransform="translateZ(0) translate"+e+"("+(n+i*(s-1))+"px)"}},r._transitionEndEvent=function(){var t;return function(){if(t)return t;var e=document.createElement("fakeElement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(var s in i)if(i.hasOwnProperty(s)&&void 0!==e.style[s])return t=i[s]}}();var o=r.prototype;o.extend=r.extend,o._setting=function(){this._plugins=r.plugins,this._animateFuncs=r._animateFuncs,this.holding=!1,this.locking=!1;var s=this._opts;this.wrap=s.dom,this.data=s.data,this.type=s.type||null,this.isVertical=s.isVertical||!1,this.isOverspread=s.isOverspread||!1,this.duration=s.duration||2e3,this.initIndex=s.initIndex||0,this.fixPage=s.fixPage||!0,(this.initIndex>this.data.length-1||this.initIndex<0)&&(this.initIndex=0),this.slideIndex=this.slideIndex||this.initIndex||0,this.axis=this.isVertical?"Y":"X",this.reverseAxis="Y"===this.axis?"X":"Y",this.width=this.wrap.clientWidth,this.height=this.wrap.clientHeight,this.ratio=this.height/this.width,this.scale=this.isVertical?this.height:this.width,this.isLoading=s.isLoading,this.offset=this.offset||{X:0,Y:0},this.isLooping=this.data.length>1&&s.isLooping?!0:!1,this.isAutoplay=this.data.length>1&&s.isAutoplay?!0:!1,"card"===s.animateType&&this.isVertical&&(this.isOverspread=!0),this.log=s.isDebug?function(){t.console.log.apply(t.console,arguments)}:r.EMPTY_FUNCTION,this._setUpDamping(),this._animateFunc=this._animateFuncs[s.animateType in this._animateFuncs?s.animateType:"default"],this.animateTime=null!=s.animateTime&&s.animateTime>-1?s.animateTime:300,this.animateEasing=e(s.animateEasing,r.EASING[0])||r.EASING[1].test(s.animateEasing)?s.animateEasing:"ease",this.inAnimate=0,this.deviceEvents=function(){var e=!!("ontouchstart"in t||t.DocumentTouch&&document instanceof t.DocumentTouch);return{hasTouch:e,startEvt:e?"touchstart":"mousedown",moveEvt:e?"touchmove":"mousemove",endEvt:e?"touchend":"mouseup"}}(),this.events={},this.on("slide",s.onslide),this.on("slideStart",s.onslidestart),this.on("slideEnd",s.onslideend),this.on("slideChange",s.onslidechange),this.on("slideChanged",s.onslidechanged),this.on("slideRestore",s.onsliderestore),this.on("slideRestored",s.onsliderestored),this.pluginConfig=function(){if(i(s.plugins)){var t={};return s.plugins.forEach(function(e){i(e)?t[e[0]]=e.slice(1):"string"==typeof e&&(t[e]=[])}),t}return{}}(),this.isAutoplay&&this.play()},o._initPlugins=function(){var t=this.pluginConfig,e=this._plugins;for(var i in t)t.hasOwnProperty(i)&&e.hasOwnProperty(i)&&(this.log("[INIT PLUGIN]:",i,e[i]),e[i]&&"function"==typeof e[i]&&typeof e[i].apply&&e[i].apply(this,t[i]))},o._setUpDamping=function(){var t=this.scale>>1,e=t>>1,i=e>>2;this._damping=function(s){var n,a=Math.abs(s);return n=t>a?a>>1:t+e>a?e+(a-t>>2):e+i+(a-t-e>>3),s>0?n:-n}},o._itemType=function(t){var e=this.data[t].content;return null==e?"empty":Boolean(e.nodeName)&&Boolean(e.nodeType)?"node":"string"==typeof e?h(e)?"pic":"html":"unknown"},o._renderItem=function(t,e){var i,s,n=this.data.length,a=function(){s=i.height/i.width>this.ratio?'':'',t.innerHTML=s}.bind(this);if(t.innerHTML="",t.style.background="",this.isLooping||null!=this.data[e]){e=(n+e)%n,i=this.data[e];var h=i.type||(i.type=this._itemType(e));switch(this.log("[Render ITEM]:",h,e,i),t.className="islider-"+h,h){case"pic":if(this.isOverspread)t.style.background="url("+i.content+") no-repeat 50% 50%/cover";else if(i.height&&i.width)a();else{var r=new Image;r.src=i.content,r.onload=function(){i.height=r.height,i.width=r.width,a()}}break;case"dom":case"html":t.innerHTML=i.content;break;case"node":case"element":if(11===i.content.nodeType){var o=document.createElement("div");o.appendChild(i.content),i.content=o}t.appendChild(i.content)}}},o._renderIntermediateScene=function(){null!=this._intermediateScene&&(this._renderItem.apply(this,this._intermediateScene),this._intermediateScene=null)},o._changedStyles=function(){var t=["islider-prev","islider-active","islider-next"];this.els.forEach(function(e,i){a(e,"("+t.join("|")+")"),n(e,t[i])})},o._renderHTML=function(){this.outer&&(this.outer.innerHTML="");var t=this.outer||document.createElement("ul");if(t.className="islider-outer","pic"===this.type&&!this.loader&&this.isLoading){var e=document.createElement("div");e.className="islider-loader",this.loader=e,this.wrap.appendChild(e),this.fire("loading")}this.els=[];for(var i=0;3>i;i++){var s=document.createElement("li");this.els.push(s),this._animateFunc(s,this.axis,this.scale,i,0),!this.isVertical||"rotate"!==this._opts.animateType&&"flip"!==this._opts.animateType?this._renderItem(s,i-1+this.slideIndex):this._renderItem(s,1-i+this.slideIndex),t.appendChild(s)}this._changedStyles(),this._initLoadImg(),this.outer||(this.outer=t,this.wrap.appendChild(t))},o._preloadImg=function(t){if("pic"===this.type&&this.data.length>3){var e=this.data,i=e.length,s=function(t){if(t>-1&&"pic"===e[t].type&&!e[t].loaded){var i=new Image;i.src=e[t].content,i.onload=function(){e[t].width=i.width,e[t].height=i.height},e[t].loaded=1}};s(t+2>i-1?(t+2)%i:t+2),s(0>t-2?i-2+t:t-2)}},o._initLoadImg=function(){var e=this.data,i=e.length,s=this.slideIndex,n=this;if("pic"===this.type&&i>3){var a=s+2>i?(s+1)%i:s+1,h=0>s-1?i-1+s:s-1;e[s].loaded=1,e[a].loaded=1,n.isLooping&&(e[h].loaded=1),t.setTimeout(function(){n._preloadImg(s)},200)}},o._watchTransitionEnd=function(e,i){function s(){a&&t.clearTimeout(a),h.inAnimate--,h.log("Event:","watchTransitionEnd::stuck::release",h.inAnimate),0===h.inAnimate&&("slideChanged"===i&&h._changedStyles(),h.fire.apply(h,o),h._renderIntermediateScene()),n()}function n(){h.els.forEach(function(t){t.removeEventListener(r._transitionEndEvent(),s)}),h.isAnimating=!1}var a,h=this,o=Array.prototype.slice.call(arguments,1);this.log("Event:","watchTransitionEnd::stuck::pile",this.inAnimate),e>0&&h.els.forEach(function(t){t.addEventListener(r._transitionEndEvent(),s)}),a=t.setTimeout(s,e),h.inAnimate++},o._bindHandler=function(){var e=this.outer,i=this.deviceEvents;i.hasTouch||(e.style.cursor="pointer",e.ondragstart=function(t){return t?!1:!0}),e.addEventListener(i.startEvt,this),e.addEventListener(i.moveEvt,this),e.addEventListener(i.endEvt,this),t.addEventListener("orientationchange",this),t.addEventListener("resize",this),t.addEventListener("focus",this,!1),t.addEventListener("blur",this,!1)},o.handleEvent=function(t){var e=this.deviceEvents;switch(t.type){case e.startEvt:this.startHandler(t);break;case e.moveEvt:this.moveHandler(t);break;case e.endEvt:this.endHandler(t);break;case"touchcancel":this.endHandler(t);break;case"orientationchange":this.orientationchangeHandler();break;case"focus":this.isAutoplay&&this.play();break;case"blur":this.pause();break;case"resize":this.resizeHandler()}},o.startHandler=function(t){if(this.fixPage){var e=t.target,i=["SELECT","INPUT","TEXTAREA","BUTTON","LABEL"];i.indexOf(e.tagName)<0&&t.preventDefault()}if(!this.holding&&!this.locking){var s=this.deviceEvents;this.isMoving=!0,this.pause(),this.log("Event: start"),this.fire("slideStart",t,this),this.startTime=(new Date).getTime(),this.startX=s.hasTouch?t.targetTouches[0].pageX:t.pageX,this.startY=s.hasTouch?t.targetTouches[0].pageY:t.pageY}},o.moveHandler=function(t){if(this.isMoving){this.log("Event: moving");var e=this.deviceEvents,i=this.data.length,s=this.axis,n=this.reverseAxis,a={X:e.hasTouch?t.targetTouches[0].pageX-this.startX:t.pageX-this.startX,Y:e.hasTouch?t.targetTouches[0].pageY-this.startY:t.pageY-this.startY};if(this.offset=a,Math.abs(a[s])-Math.abs(a[n])>10){t.preventDefault(),this.fire("slide",t,this),this.isLooping||(a[s]>0&&0===this.slideIndex||a[s]<0&&this.slideIndex===i-1)&&(a[s]=this._damping(a[s]));for(var h=0;3>h;h++){var r=this.els[h];r.style.webkitTransition="all 0s",this._animateFunc(r,s,this.scale,h,a[s])}}}},o.endHandler=function(e){if(this.isMoving){this.log("Event: end"),this.isMoving=!1;var i=this.offset,s=this.axis,n=this.scale/2,a=(new Date).getTime();n=a-this.startTime>300?n:14;var h=Math.abs(i[s]),r=Math.abs(i[this.reverseAxis]),o=function(e){if("A"===e.tagName){if(e.href)return t.location.href=e.href,!1}else{if("islider-pic"!==e.className)return!1;o(e.parentNode)}};this.log(n,i[s],h,r,this),this.slideTo(i[s]>=n&&h>r?this.slideIndex-1:i[s]<-n&&h>r?this.slideIndex+1:this.slideIndex),Math.abs(this.offset.X)<10&&Math.abs(this.offset.Y)<10&&(this.tapEvt=document.createEvent("Event"),this.tapEvt.initEvent("tap",!0,!0),this.fixPage&&e.target&&o(e.target),e.target.dispatchEvent(this.tapEvt)||e.preventDefault()),this.offset.X=this.offset.Y=0,this.isAutoplay&&this.play(),this.fire("slideEnd",e,this)}},o.orientationchangeHandler=function(){t.setTimeout(function(){this.reset(),this.log("Event: orientationchange")}.bind(this),100)},o.resizeHandler=function(){(this.height!==this.wrap.clientHeight||this.width!==this.wrap.clientWidth)&&(this._LSN.resize&&t.clearTimeout(this._LSN.resize),this._LSN.resize=t.setTimeout(function(){this.reset(),this.log("Event: resize"),this._LSN.resize&&t.clearTimeout(this._LSN.resize)}.bind(this),500))},o.slideTo=function(e,i){if(!this.locking){this.unhold();var s,n=this.animateTime,a=this._opts.animateType,h=this._animateFunc,r=this.data,o=this.els,l=e,d=e-this.slideIndex,c=this.offset;"object"==typeof i&&(i.animateTime>-1&&(n=i.animateTime),"string"==typeof i.animateType&&i.animateType in this._animateFuncs&&(a=i.animateType,h=this._animateFuncs[a]));var u=Math.abs(c[this.axis])/this.scale*n;Math.abs(d)>1&&this._renderItem(d>0?this.els[2]:this.els[0],l),this._preloadImg(l),r[l]?this.slideIndex=l:this.isLooping?this.slideIndex=d>0?0:r.length-1:(this.slideIndex=this.slideIndex,d=0),this.log("Index:"+this.slideIndex);var p,f,g;0===d?s="slideRestore":((this.isVertical&&("rotate"===a||"flip"===a))^d>0?(o.push(o.shift()),p=o[2],f=o[0],g=1):(o.unshift(o.pop()),p=o[0],f=o[2],g=-1),1===Math.abs(d)?(this._renderIntermediateScene(),this._renderItem(p,l+d)):Math.abs(d)>1&&(this._renderItem(p,l+g),this._intermediateScene=[f,l-g]),p.style.webkitTransition="none",p.style.visibility="hidden",t.setTimeout(function(){p.style.visibility="visible"},200),u=n-u,s="slideChange"),this.fire(s,this.slideIndex,o[1],this),this._watchTransitionEnd(u,s+"d",this.slideIndex,o[1],this);for(var m=0;3>m;m++)o[m]!==p&&(o[m].style.webkitTransition="all "+u/1e3+"s "+this.animateEasing),h.call(this,o[m],this.axis,this.scale,m,0);this.isAutoplay&&!this.isLooping&&this.slideIndex===r.length-1&&this.pause()}},o.slideNext=function(){this.slideTo.apply(this,[this.slideIndex+1].concat(Array.prototype.slice.call(arguments)))},o.slidePrev=function(){this.slideTo.apply(this,[this.slideIndex-1].concat(Array.prototype.slice.call(arguments)))},o.regPlugin=function(){var t=Array.prototype.slice.call(arguments),i=t.shift(),s=t[0];(this._plugins.hasOwnProperty(i)||"function"==typeof s)&&("function"==typeof s&&(this._plugins[i]=s,t.shift()),e(i,this._opts.plugins)||(this._opts.plugins.push(t.length?[].concat([i],t):i),"function"==typeof this._plugins[i]&&this._plugins[i].apply(this,t)))},o.bind=o.delegate=function(e,i,s){function n(e){for(var n=t.event?t.event:e,a=n.target,h=document.querySelectorAll(i),r=0;r-1&&delete i[s]}},o.fire=function(t){if(this.log("[EVENT FIRE]:",t,arguments),t in this.events)for(var e=this.events[t],i=0;i this.data.length - 1 || this.initIndex < 0) { this.initIndex = 0; } + /** + * slideIndex + * @type {number} + * @private + */ this.slideIndex = this.slideIndex || this.initIndex || 0; + /** + * Axis + * @type {string} + * @public + */ this.axis = this.isVertical ? 'Y' : 'X'; + + /** + * reverseAxis + * @type {string} + * @private + */ this.reverseAxis = this.axis === 'Y' ? 'X' : 'Y'; + /** + * Wrapper width + * @type {number} + * @private + */ this.width = this.wrap.clientWidth; + + /** + * Wrapper height + * @type {number} + * @private + */ this.height = this.wrap.clientHeight; + + /** + * Ratio height:width + * @type {number} + * @private + */ this.ratio = this.height / this.width; + + /** + * Scale, size rule + * @type {number} + * @private + */ this.scale = this.isVertical ? this.height : this.width; + // TODO will be removed this.isLoading = opts.isLoading; + /** + * On slide offset position + * @type {{X: number, Y: number}} + * @private + */ this.offset = this.offset || {X: 0, Y: 0}; - // looping logic adjust - if (this.data.length < 2) { - this.isLooping = false; - this.isAutoPlay = false; - } - else { - this.isLooping = opts.isLooping || false; - this.isAutoplay = opts.isAutoplay || false; - } + /** + * looping logic adjust + * @type {boolean} + * @private + */ + this.isLooping = this.data.length > 1 && opts.isLooping ? true : false; + + /** + * autoplay logic adjust + * @type {boolean} + * @private + */ + this.isAutoplay = this.data.length > 1 && opts.isAutoplay ? true : false; // little trick set, when you chooce tear & vertical same time // iSlider overspread mode will be set true autometicly @@ -355,7 +435,11 @@ this.isOverspread = true; } - // debug mode + /** + * Debug mode + * @type {function} + * @private + */ this.log = opts.isDebug ? function () { global.console.log.apply(global.console, arguments); } : iSlider.EMPTY_FUNCTION; @@ -371,21 +455,35 @@ */ this._animateFunc = this._animateFuncs[opts.animateType in this._animateFuncs ? opts.animateType : 'default']; - // set animate process time (ms), default: 300ms + /** + * animate process time (ms), default: 300ms + * @type {number} + * @public + */ this.animateTime = opts.animateTime != null && opts.animateTime > -1 ? opts.animateTime : 300; - // set animate effects, default: ease + /** + * animate effects, default: ease + * @type {string} + * @public + */ this.animateEasing = inArray(opts.animateEasing, iSlider.EASING[0]) || iSlider.EASING[1].test(opts.animateEasing) ? opts.animateEasing : 'ease'; + /** + * In slide animation + * @type {number} + * @private + */ this.inAnimate = 0; /** * Fix touch/mouse events * @type {{hasTouch, startEvt, moveEvt, endEvt}} + * @private */ this.deviceEvents = (function () { var hasTouch = !!(('ontouchstart' in global) || global.DocumentTouch && document instanceof global.DocumentTouch); @@ -567,7 +665,7 @@ item = this.data[dataIndex]; } - var type = this.type != null ? this.type : item.type || (item.type = this._itemType(dataIndex)); + var type = item.type || (item.type = this._itemType(dataIndex)); this.log('[Render ITEM]:', type, dataIndex, item); @@ -731,7 +829,7 @@ data[prevIndex].loaded = 1; } - setTimeout(function () { + global.setTimeout(function () { self._preloadImg(idx); }, 200); } @@ -803,6 +901,7 @@ outer.addEventListener(device.endEvt, this); global.addEventListener('orientationchange', this); + global.addEventListener('resize', this); // Fix android device global.addEventListener('focus', this, false); @@ -839,6 +938,9 @@ case 'blur': this.pause(); break; + case 'resize': + this.resizeHandler(); + break; } }; @@ -984,12 +1086,27 @@ * @protected */ iSliderPrototype.orientationchangeHandler = function () { - setTimeout(function () { + global.setTimeout(function () { this.reset(); this.log('Event: orientationchange'); }.bind(this), 100); }; + /** + * resize callback + * @protected + */ + iSliderPrototype.resizeHandler = function () { + if (this.height !== this.wrap.clientHeight || this.width !== this.wrap.clientWidth) { + this._LSN.resize && global.clearTimeout(this._LSN.resize); + this._LSN.resize = global.setTimeout(function () { + this.reset(); + this.log('Event: resize'); + this._LSN.resize && global.clearTimeout(this._LSN.resize); + }.bind(this), 500); + } + }; + /** * slide logical, goto data index * @param {number} dataIndex the goto index @@ -1047,7 +1164,7 @@ this.log('Index:' + this.slideIndex); // keep the right order of items - var headEl, tailEl; + var headEl, tailEl, step; // slidechange should render new item // and change new item style to fit animation @@ -1055,38 +1172,33 @@ // Restore to current scene eventType = 'slideRestore'; } else { - // TODO - var ori = (this.isVertical && (animateType === 'rotate' || animateType === 'flip')) ^ (n > 0) - if (ori) { + + if ((this.isVertical && (animateType === 'rotate' || animateType === 'flip')) ^ (n > 0)) { els.push(els.shift()); headEl = els[2]; tailEl = els[0]; + step = 1; } else { els.unshift(els.pop()); headEl = els[0]; tailEl = els[2]; + step = -1; } - // slide to next/prev scenes - //if (Math.abs(n) > 1) { - // this._renderItem(els[0], idx - 1); - // this._renderItem(els[2], idx + 1); - //} - //else + if (Math.abs(n) === 1) { this._renderIntermediateScene(); this._renderItem(headEl, idx + n); } else if (Math.abs(n) > 1) { - // this._renderItem(els[n < 0 ? 0 : 2], idx + n + (n < 0 ? -1 : 1)); - this._renderItem(headEl, idx + (ori ? 1 : -1)); - this._intermediateScene = [tailEl, idx + (ori ? -1 : 1)]; + this._renderItem(headEl, idx + step); + this._intermediateScene = [tailEl, idx - step]; } + headEl.style.webkitTransition = 'none'; headEl.style.visibility = 'hidden'; - // TODO - // ??? - setTimeout(function () { + // TODO ??? + global.setTimeout(function () { headEl.style.visibility = 'visible'; }, 200); @@ -1237,8 +1349,7 @@ if (eventName in this.events) { var funcs = this.events[eventName]; for (var i = 0; i < funcs.length; i++) { - // TODO - // will support custom context, now context is instance of iSlider + // TODO will support custom context, now context is instance of iSlider typeof funcs[i] === 'function' && funcs[i].apply && funcs[i].apply(this, Array.prototype.slice.call(arguments, 1)); diff --git a/src/index.html b/src/index.html index 0e8c903c..a7127133 100644 --- a/src/index.html +++ b/src/index.html @@ -57,7 +57,6 @@ }); var islider = new iSlider({ - // type: 'pic', data: list, dom: document.getElementById("iSlider-wrapper"), // isVertical: true, @@ -75,7 +74,8 @@ onslidechange: function () { console.debug(arguments, 'Change~ juse one time'); this.off('slideChange', arguments.callee); - } + }, + isLoading: true }); islider.on('slideChange', function () { diff --git a/src/js/iSlider.js b/src/js/iSlider.js index d909276e..ba768b94 100644 --- a/src/js/iSlider.js +++ b/src/js/iSlider.js @@ -125,6 +125,13 @@ */ this._opts = opts; + /** + * listener + * @type {{}} + * @private + */ + this._LSN = {}; + this._setting(); this._renderHTML(); this._initPlugins(); @@ -290,64 +297,137 @@ var opts = this._opts; - // dom element wrapping content + /** + * dom element wrapping content + * @type {Element} + * @public + */ this.wrap = opts.dom; - // your data + /** + * Data list + * @type {Array} + * @public + */ this.data = opts.data; // default type + // TODO will be renamed this.type = opts.type || null; - // default slide direction + /** + * default slide direction + * @type {boolean} + * @public + */ this.isVertical = opts.isVertical || false; - // Overspread mode + /** + * Overspread mode + * @type {boolean} + * @public + */ this.isOverspread = opts.isOverspread || false; - // Play time gap + /** + * Play time gap + * @type {number} + * @public + */ this.duration = opts.duration || 2000; - // start from initIndex or 0 + /** + * start from initIndex or 0 + * @type {number} + * @public + */ this.initIndex = opts.initIndex || 0; - // touchstart prevent default to fixPage - if (opts.fixPage === undefined) { - this.fixPage = true; - } - else { - this.fixPage = opts.fixPage; - } + /** + * touchstart prevent default to fixPage + * @type {boolean} + * @public + */ + this.fixPage = opts.fixPage || true; - // TODO - // in looping mode, will support index overflow + // When initIndex overflow + // TODO in looping mode, will support index overflow if (this.initIndex > this.data.length - 1 || this.initIndex < 0) { this.initIndex = 0; } + /** + * slideIndex + * @type {number} + * @private + */ this.slideIndex = this.slideIndex || this.initIndex || 0; + /** + * Axis + * @type {string} + * @public + */ this.axis = this.isVertical ? 'Y' : 'X'; + + /** + * reverseAxis + * @type {string} + * @private + */ this.reverseAxis = this.axis === 'Y' ? 'X' : 'Y'; + /** + * Wrapper width + * @type {number} + * @private + */ this.width = this.wrap.clientWidth; + + /** + * Wrapper height + * @type {number} + * @private + */ this.height = this.wrap.clientHeight; + + /** + * Ratio height:width + * @type {number} + * @private + */ this.ratio = this.height / this.width; + + /** + * Scale, size rule + * @type {number} + * @private + */ this.scale = this.isVertical ? this.height : this.width; + // TODO will be removed this.isLoading = opts.isLoading; + /** + * On slide offset position + * @type {{X: number, Y: number}} + * @private + */ this.offset = this.offset || {X: 0, Y: 0}; - // looping logic adjust - if (this.data.length < 2) { - this.isLooping = false; - this.isAutoPlay = false; - } - else { - this.isLooping = opts.isLooping || false; - this.isAutoplay = opts.isAutoplay || false; - } + /** + * looping logic adjust + * @type {boolean} + * @private + */ + this.isLooping = this.data.length > 1 && opts.isLooping ? true : false; + + /** + * autoplay logic adjust + * @type {boolean} + * @private + */ + this.isAutoplay = this.data.length > 1 && opts.isAutoplay ? true : false; // little trick set, when you chooce tear & vertical same time // iSlider overspread mode will be set true autometicly @@ -355,7 +435,11 @@ this.isOverspread = true; } - // debug mode + /** + * Debug mode + * @type {function} + * @private + */ this.log = opts.isDebug ? function () { global.console.log.apply(global.console, arguments); } : iSlider.EMPTY_FUNCTION; @@ -371,21 +455,35 @@ */ this._animateFunc = this._animateFuncs[opts.animateType in this._animateFuncs ? opts.animateType : 'default']; - // set animate process time (ms), default: 300ms + /** + * animate process time (ms), default: 300ms + * @type {number} + * @public + */ this.animateTime = opts.animateTime != null && opts.animateTime > -1 ? opts.animateTime : 300; - // set animate effects, default: ease + /** + * animate effects, default: ease + * @type {string} + * @public + */ this.animateEasing = inArray(opts.animateEasing, iSlider.EASING[0]) || iSlider.EASING[1].test(opts.animateEasing) ? opts.animateEasing : 'ease'; + /** + * In slide animation + * @type {number} + * @private + */ this.inAnimate = 0; /** * Fix touch/mouse events * @type {{hasTouch, startEvt, moveEvt, endEvt}} + * @private */ this.deviceEvents = (function () { var hasTouch = !!(('ontouchstart' in global) || global.DocumentTouch && document instanceof global.DocumentTouch); @@ -567,7 +665,7 @@ item = this.data[dataIndex]; } - var type = this.type != null ? this.type : item.type || (item.type = this._itemType(dataIndex)); + var type = item.type || (item.type = this._itemType(dataIndex)); this.log('[Render ITEM]:', type, dataIndex, item); @@ -731,7 +829,7 @@ data[prevIndex].loaded = 1; } - setTimeout(function () { + global.setTimeout(function () { self._preloadImg(idx); }, 200); } @@ -803,6 +901,7 @@ outer.addEventListener(device.endEvt, this); global.addEventListener('orientationchange', this); + global.addEventListener('resize', this); // Fix android device global.addEventListener('focus', this, false); @@ -839,6 +938,9 @@ case 'blur': this.pause(); break; + case 'resize': + this.resizeHandler(); + break; } }; @@ -984,12 +1086,27 @@ * @protected */ iSliderPrototype.orientationchangeHandler = function () { - setTimeout(function () { + global.setTimeout(function () { this.reset(); this.log('Event: orientationchange'); }.bind(this), 100); }; + /** + * resize callback + * @protected + */ + iSliderPrototype.resizeHandler = function () { + if (this.height !== this.wrap.clientHeight || this.width !== this.wrap.clientWidth) { + this._LSN.resize && global.clearTimeout(this._LSN.resize); + this._LSN.resize = global.setTimeout(function () { + this.reset(); + this.log('Event: resize'); + this._LSN.resize && global.clearTimeout(this._LSN.resize); + }.bind(this), 500); + } + }; + /** * slide logical, goto data index * @param {number} dataIndex the goto index @@ -1047,7 +1164,7 @@ this.log('Index:' + this.slideIndex); // keep the right order of items - var headEl, tailEl; + var headEl, tailEl, step; // slidechange should render new item // and change new item style to fit animation @@ -1055,38 +1172,33 @@ // Restore to current scene eventType = 'slideRestore'; } else { - // TODO - var ori = (this.isVertical && (animateType === 'rotate' || animateType === 'flip')) ^ (n > 0) - if (ori) { + + if ((this.isVertical && (animateType === 'rotate' || animateType === 'flip')) ^ (n > 0)) { els.push(els.shift()); headEl = els[2]; tailEl = els[0]; + step = 1; } else { els.unshift(els.pop()); headEl = els[0]; tailEl = els[2]; + step = -1; } - // slide to next/prev scenes - //if (Math.abs(n) > 1) { - // this._renderItem(els[0], idx - 1); - // this._renderItem(els[2], idx + 1); - //} - //else + if (Math.abs(n) === 1) { this._renderIntermediateScene(); this._renderItem(headEl, idx + n); } else if (Math.abs(n) > 1) { - // this._renderItem(els[n < 0 ? 0 : 2], idx + n + (n < 0 ? -1 : 1)); - this._renderItem(headEl, idx + (ori ? 1 : -1)); - this._intermediateScene = [tailEl, idx + (ori ? -1 : 1)]; + this._renderItem(headEl, idx + step); + this._intermediateScene = [tailEl, idx - step]; } + headEl.style.webkitTransition = 'none'; headEl.style.visibility = 'hidden'; - // TODO - // ??? - setTimeout(function () { + // TODO ??? + global.setTimeout(function () { headEl.style.visibility = 'visible'; }, 200); @@ -1237,8 +1349,7 @@ if (eventName in this.events) { var funcs = this.events[eventName]; for (var i = 0; i < funcs.length; i++) { - // TODO - // will support custom context, now context is instance of iSlider + // TODO will support custom context, now context is instance of iSlider typeof funcs[i] === 'function' && funcs[i].apply && funcs[i].apply(this, Array.prototype.slice.call(arguments, 1)); From afb069410d31bf2097cb6e91233df8b754083157 Mon Sep 17 00:00:00 2001 From: shinate Date: Thu, 24 Sep 2015 21:15:58 +0800 Subject: [PATCH 07/18] change logo --- README.md | 2 +- README_Chinese.md | 2 +- thumbnails/iSlider-logo.png | Bin 0 -> 38135 bytes 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 thumbnails/iSlider-logo.png diff --git a/README.md b/README.md index 6eff9449..ce62d523 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # iSlider -![](thumbnails/logo.png) +![](thumbnails/iSlider-logo.png) #### [iSlider English Official Page](http://be-fe.github.io/iSlider/index_en.html) #### [iSlider English README](https://github.com/BE-FE/iSlider/blob/master/README.md) diff --git a/README_Chinese.md b/README_Chinese.md index efcf7b91..63c2d0d1 100755 --- a/README_Chinese.md +++ b/README_Chinese.md @@ -1,6 +1,6 @@ # iSlider -![](thumbnails/logo.png) +![](thumbnails/iSlider-logo.png) #### [iSlider English Official Page](http://be-fe.github.io/iSlider/index_en.html) #### [iSlider English README](https://github.com/BE-FE/iSlider/blob/master/README.md) diff --git a/thumbnails/iSlider-logo.png b/thumbnails/iSlider-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..77297e7d346987b989a4a92673b3804f80999ba3 GIT binary patch literal 38135 zcmbSyRajeX(=P5U?(RVo+&#FvJHd+=DDK5QSShZ>wYWpk;%zDJ#VPLH>HEpv2mkdS z?3^TP<&lwlX3fl+Cq_d}{uKrp1{@sRD@6sc791P`1soi_JsJY+PTH3iOV}5wm#l%8 zwyUj|kEI6$PRhpB3PPj!#?lU=1+lbw=RO7zg@Z$MbI>vHGEh|!wsw8PY58{yr|%m# z*lajBQ3+o+OKT^H7mXFf&cQ{D?yR$yj>f@8j830V6{PAW1F?5d@biFZ`>E+z`#D() z+0aRd(}?;C!xnf0@v@}xedFxnDeNmo_s_b*u-|`g1L^YNjQ?@8r_MV!2v7^+>H5~g8m13h`u|LZ$?kvO=0%A}&%O?@eg8dI z=zpCnEaL&O^m6skadmb64+1poUAxg>YDcAVM5A5MF*hD~L5e$X1Z< z-}7z$f20S55d{1Tlm7=c|G5Rj;@_YDH3Hbhf6WNu0<#?tn2`|MvZKPmrBEt@rF49M z9(NnoGkkxye*e+LvE6vRr@NqY)}FU@L@s1VIt)&KmX1-YlW{rq_*~)UM{$bvp2MC4 z9Ys)9^zV7_BzQ91mN%7se$E%*P_b#i%a}u_kc`7JXMk1!Z{_6ts^I%_;AbQ5OBLJ2 znopCSJ!iSVrbd_bQ*lz&dKW!gJw3g}``tf(IOIjIMDSKTI5>-L5MwEY-nj3sS6+|u zJWq{cEKk44i^l1@%S`jNBc0+27P-9^a4JZL#IzNCf8X1gd%BU@-kl|68daxtri}K5 z5S8$=iK}3CjWEj~t9vPMm~d9O6pr3QL_w(OGyS1xn_KFz)G$XPK*ZaoVf(E6!kAO! zYwSe{3u>0(9K_e{fFaJ9LWe@L7Nq7oXQOu^JE_r=RYx+CZ26`WM-%#_qNvf&r0nXY7M`;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(>!i)|_=JGSe)I*;3TW0bFt3>Y9qeE!1}Ik{Rt zAf=ydai_autilT)D-=^4=yNqca=S-WnOuThY5vvkK4(tZVEdVzQ|kRMxZxr$E2fQ{ z^bu%3@}R0Uv?{fLvI}YlFK+uo!VV`R=WQNE9{GJ^wAgmE+Q;g=Rxf&?$UGF6p)g)Vh}|O<-qjYFtzQFe|C&Mo6}zRJq$0FHrqO`4Y$CSF>LIN zqSDw*@|5h^#>kFcXr7uYpTI_uxIt016&|(|qVnX)Z@imH>SO-}*s8i>n*Z4%`kdak zKMMb>f1D&YV&e>t>h1Pl7L>jJL#{s2qGKT)GnF2mw~iTxc%-`Zuux+XHBR=-z@yk>c{?H z#X$$B_h4TcT6f7Nge?I*OryV0m_pq_b|J+3N*YFo1(N9}Y;qrje6nrd6{L5;_n&Da z6bib6*pq@z$lw_`2zVvv@wPod^YXpkZmr!?%fscY!?YK}48Lt3-pgKkGivRi^s-aM zb@i|M*Ic9p!;tV|^G5WdaK@{I|L%UMTk3>H5d7RvIH2U@qqvCpO!M?D(49W7&CjqIGk~HDy_$w_S zFvdBpUobA`1XtZI0``psIvXsv@Ao{9cl^iTVsA_fa5$f*%(URdZ5jv`1$npmXVSR5 zlU=uaH}n4>GKVyz#Q(FgB9Vp Date: Tue, 6 Oct 2015 10:19:53 +0800 Subject: [PATCH 08/18] rename files --- bower.json | 16 ++++++++-------- thumbnails/{logo.png => iSlider-logo-old.png} | Bin 2 files changed, 8 insertions(+), 8 deletions(-) rename thumbnails/{logo.png => iSlider-logo-old.png} (100%) diff --git a/bower.json b/bower.json index 4b664d1a..d9239953 100644 --- a/bower.json +++ b/bower.json @@ -3,9 +3,8 @@ "homepage": "https://github.com/BE-FE/iSlider", "description": "light smooth mobile slide plugin", "main": [ - "build/islider.js", - "build/islider.css", - "build/islider_core.js" + "build/iSlider.min.js", + "build/iSlider.min.css" ], "keywords": [ "slide", @@ -13,15 +12,16 @@ ], "authors": [ "qbaty", - "xieyu33333" + "xieyu33333", + "shinate" ], "license": "MIT", "ignore": [ "**/.*", "node_modules", - "bower_components", - "test", - "tests" + "*.iml", + ".idea", + "test" ], - "version": "1.1.1" + "version": "2.0.0" } diff --git a/thumbnails/logo.png b/thumbnails/iSlider-logo-old.png similarity index 100% rename from thumbnails/logo.png rename to thumbnails/iSlider-logo-old.png From 8843e3fa1d58062011bb29144fd2e515e4fbb805 Mon Sep 17 00:00:00 2001 From: shinate Date: Tue, 6 Oct 2015 10:22:07 +0800 Subject: [PATCH 09/18] update package.json --- package.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d414e91f..e1e95178 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "islider", + "name": "iSlider", "version": "2.0.0", "author": "qbatyqi", - "main": "build/iSlider.js", + "main": "build/iSlider.min.js", "description": "Smooth mobile touch slider for Mobile WebApp, HTML5 App, Hybrid App", "devDependencies": { "amdclean": "~2.4.0", @@ -19,6 +19,11 @@ "url": "git@github.com:BE-FE/iSlider.git" }, "keywords": [ + "smooth", + "hybrid", + "slide", + "animate", + "effect", "mobile", "iSlider.js", "javascript" From 5f9dafbba1fbb56e6a5f4c46b7c32ad1965a2044 Mon Sep 17 00:00:00 2001 From: shinate Date: Wed, 7 Oct 2015 00:03:28 +0800 Subject: [PATCH 10/18] add fixpage whitelist, save image file in every "pic" scene --- src/index.html | 4 +-- src/js/iSlider.js | 81 +++++++++++++++++++++++++---------------------- 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/index.html b/src/index.html index a7127133..4ba3aa3b 100644 --- a/src/index.html +++ b/src/index.html @@ -67,6 +67,7 @@ fixPage: 1, isDebug: 1, // isDebug: 0, + // isLoading: true, plugins: ['dot', 'button', ['zoompic', {zoomFactor: 2}]], onslide: function () { console.debug(arguments) @@ -74,8 +75,7 @@ onslidechange: function () { console.debug(arguments, 'Change~ juse one time'); this.off('slideChange', arguments.callee); - }, - isLoading: true + } }); islider.on('slideChange', function () { diff --git a/src/js/iSlider.js b/src/js/iSlider.js index ba768b94..63db4783 100644 --- a/src/js/iSlider.js +++ b/src/js/iSlider.js @@ -155,6 +155,13 @@ /cubic-bezier\(([^\d]*(\d+.?\d*)[^\,]*\,?){4}\)/ ]; + /** + * TAGS whitelist on fixpage mode + * @type {Array} + * @protected + */ + iSlider.FIX_PAGE_TAGS = 'SELECT INPUT TEXTAREA BUTTON LABEL'.split(' '); + /** * The empty function * @private @@ -167,19 +174,18 @@ * @public */ iSlider.extend = function () { - if (!arguments.length) { - return; - } + var main, extend, args = arguments; - var main, extend; - switch (arguments.length) { + switch (args.length) { + case 0: + return; case 1: main = iSlider.prototype; - extend = arguments[0]; + extend = args[0]; break; case 2: - main = arguments[0]; - extend = arguments[1]; + main = args[0]; + extend = args[1]; break; } @@ -639,16 +645,24 @@ */ iSliderPrototype._renderItem = function (el, dataIndex) { - var item; - var html; - var len = this.data.length; - // var self = this; + var item, len = this.data.length; var insertImg = function () { - html = item.height / item.width > this.ratio - ? '' - : ''; - el.innerHTML = html; + + var simg = ' src="' + item.content + '"'; + + if (item.height / item.width > this.ratio) { + simg += ' height="' + el.clientHeight + '"'; + } else { + simg += ' width="' + el.clientWidth + '"'; + } + + if (this.isOverspread) { + el.style.background = 'url(' + item.content + ') no-repeat 50% 50%/cover'; + simg += ' style="display:block;opacity:0;height:100%;width:100%;"' + } + + el.innerHTML = ''; }.bind(this); // clean scene @@ -673,22 +687,17 @@ switch (type) { case 'pic': - if (!this.isOverspread) { - if (item.height && item.width) { - insertImg(); - } - else { - var currentImg = new Image(); - currentImg.src = item.content; - currentImg.onload = function () { - item.height = currentImg.height; - item.width = currentImg.width; - insertImg(); - }; - } + if (item.height && item.width) { + insertImg(); } else { - el.style.background = 'url(' + item.content + ') no-repeat 50% 50%/cover'; + var currentImg = new Image(); + currentImg.src = item.content; + currentImg.onload = function () { + item.height = currentImg.height; + item.width = currentImg.width; + insertImg(); + }; } break; case 'dom': @@ -917,15 +926,15 @@ iSliderPrototype.handleEvent = function (evt) { var device = this.deviceEvents; switch (evt.type) { - case device.startEvt: + case 'mousedown': + if (!(evt.button === 0 && evt.buttons === 1)) break; + case 'touchstart': this.startHandler(evt); break; case device.moveEvt: this.moveHandler(evt); break; case device.endEvt: - this.endHandler(evt); - break; case 'touchcancel': this.endHandler(evt); break; @@ -951,9 +960,7 @@ */ iSliderPrototype.startHandler = function (evt) { if (this.fixPage) { - var target = evt.target; - var whiteList = ['SELECT', 'INPUT', 'TEXTAREA', 'BUTTON', 'LABEL']; - if (whiteList.indexOf(target.tagName) < 0) { + if (iSlider.FIX_PAGE_TAGS.indexOf(evt.target.tagName) < 0) { evt.preventDefault(); } } @@ -1137,7 +1144,7 @@ } } - //In the slide process, animate time is squeezed + // In the slide process, animate time is squeezed var squeezeTime = Math.abs(offset[this.axis]) / this.scale * animateTime; if (Math.abs(n) > 1) { From 5b3da1a034ed8e4dac1483c3b2170a0b2decc36b Mon Sep 17 00:00:00 2001 From: shinate Date: Thu, 8 Oct 2015 14:24:47 +0800 Subject: [PATCH 11/18] Add timer clear in destroy --- src/index.html | 2 ++ src/js/iSlider.js | 36 +++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/index.html b/src/index.html index 4ba3aa3b..95edda7c 100644 --- a/src/index.html +++ b/src/index.html @@ -68,6 +68,8 @@ isDebug: 1, // isDebug: 0, // isLoading: true, + // isAutoplay: true, + // duration: 5000, plugins: ['dot', 'button', ['zoompic', {zoomFactor: 2}]], onslide: function () { console.debug(arguments) diff --git a/src/js/iSlider.js b/src/js/iSlider.js index 63db4783..87386129 100644 --- a/src/js/iSlider.js +++ b/src/js/iSlider.js @@ -795,6 +795,7 @@ /** * preload img when slideChange + * From current index +2, -2 scene * @param {number} dataIndex means which image will be load * @private */ @@ -1298,6 +1299,15 @@ this.wrap.addEventListener(evtType, handle, false); }; + /** + * TODO unbind, unDelegate + * remove event delegate from wrap + * @public + */ + iSliderPrototype.unbind = iSliderPrototype.unDelegate = function (eventType, selector, callback) { + + }; + /** * removeEventListener to release the memory * @public @@ -1308,12 +1318,19 @@ this.fire('destroy'); + // Clear events outer.removeEventListener(device.startEvt, this); outer.removeEventListener(device.moveEvt, this); outer.removeEventListener(device.endEvt, this); global.removeEventListener('orientationchange', this); global.removeEventListener('focus', this); global.removeEventListener('blur', this); + + // Clear timer + this._LSN.forEach(function clearTimerOnDestroy(timer) { + timer && global.clearTimeout(timer); + }); + this.wrap.innerHTML = ''; }; @@ -1389,16 +1406,21 @@ }; /** - * enable autoplay + * Start autoplay * @public */ iSliderPrototype.play = function () { var self = this; - var duration = this.duration; - clearInterval(this.autoPlayTimer); - this.autoPlayTimer = setInterval(function () { - self.slideTo(self.slideIndex + 1); - }, duration); + this._LSN.autoPlay && global.clearTimeout(this._LSN.autoPlay); + + function play() { + self._LSN.autoPlay = setTimeout(function () { + self.slideNext(); + play(); + }, self.duration); + }; + + play(); }; /** @@ -1406,7 +1428,7 @@ * @public */ iSliderPrototype.pause = function () { - clearInterval(this.autoPlayTimer); + this._LSN.autoPlay && clearTimeout(this._LSN.autoPlay); }; /** From baa9cb0e6fd0ebacaf96a97d91032aa26e4b5bed Mon Sep 17 00:00:00 2001 From: shinate Date: Thu, 8 Oct 2015 17:37:42 +0800 Subject: [PATCH 12/18] preloadimg updated --- src/js/iSlider.js | 77 +++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/src/js/iSlider.js b/src/js/iSlider.js index 87386129..66dd03f4 100644 --- a/src/js/iSlider.js +++ b/src/js/iSlider.js @@ -347,7 +347,7 @@ * @type {number} * @public */ - this.initIndex = opts.initIndex || 0; + this.initIndex = opts.initIndex > 0 && opts.initIndex < opts.data.length - 1 ? opts.initIndex : 0; /** * touchstart prevent default to fixPage @@ -356,12 +356,6 @@ */ this.fixPage = opts.fixPage || true; - // When initIndex overflow - // TODO in looping mode, will support index overflow - if (this.initIndex > this.data.length - 1 || this.initIndex < 0) { - this.initIndex = 0; - } - /** * slideIndex * @type {number} @@ -615,26 +609,39 @@ }; /** - * + * Get item type * @param {number} index * @returns {string} * @private */ - iSliderPrototype._itemType = function (dataIndex) { - var content = this.data[dataIndex].content; - if (content == null) { - return 'empty'; + iSliderPrototype._itemType = function (item) { + if (!isNaN(item)) { + item = this.data[item]; } - if (Boolean(content.nodeName) && Boolean(content.nodeType)) { - return 'node'; - } else if (typeof content === 'string') { - if (isUrl(content)) { - return 'pic'; - } - return 'html'; + if (item.hasOwnProperty('type')) { + return item.type; + } + var content = item.content; + var type; + if (content == null) { + type = 'empty'; } else { - return 'unknown'; + if (Boolean(content.nodeName) && Boolean(content.nodeType)) { + type = 'node'; + } else if (typeof content === 'string') { + if (isUrl(content)) { + type = 'pic'; + } else { + type = 'html'; + } + } else { + type = 'unknown'; + } } + + item.type = type; + + return type; }; /** @@ -679,7 +686,7 @@ item = this.data[dataIndex]; } - var type = item.type || (item.type = this._itemType(dataIndex)); + var type = this._itemType(item); this.log('[Render ITEM]:', type, dataIndex, item); @@ -696,6 +703,7 @@ currentImg.onload = function () { item.height = currentImg.height; item.width = currentImg.width; + item.loaded = 1; insertImg(); }; } @@ -706,6 +714,7 @@ break; case 'node': case 'element': + // fragment, create container if (item.content.nodeType === 11) { var entity = document.createElement('div'); entity.appendChild(item.content); @@ -794,35 +803,39 @@ }; /** + * TODO Will be fixed * preload img when slideChange * From current index +2, -2 scene * @param {number} dataIndex means which image will be load * @private */ iSliderPrototype._preloadImg = function (dataIndex) { - if (this.type === 'pic' && this.data.length > 3) { + if (this.data.length > 3) { var data = this.data; var len = data.length; - var loadImg = function (index) { - if (index > -1 && data[index].type === 'pic' && !data[index].loaded) { + var self = this; + var loadImg = function preloadImgLoadingProcess(index) { + var item = data[index]; + if (self._itemType(item) === 'pic' && !item.loaded) { var preloadImg = new Image(); - preloadImg.src = data[index].content; + preloadImg.src = item.content; preloadImg.onload = function () { - data[index].width = preloadImg.width; - data[index].height = preloadImg.height; + item.width = preloadImg.width; + item.height = preloadImg.height; }; - data[index].loaded = 1; + item.loaded = 1; } }; - loadImg(dataIndex + 2 > len - 1 ? ((dataIndex + 2) % len) : (dataIndex + 2)); - loadImg(dataIndex - 2 < 0 ? (len - 2 + dataIndex) : (dataIndex - 2)); + loadImg((dataIndex + 2) % len); + loadImg((dataIndex - 2 + len) % len); } }; /** - * load extra imgs when renderHTML - * @private + * TODO will be fixed + * load extra imgs when renderHTML + * @private */ iSliderPrototype._initLoadImg = function () { var data = this.data; From d5d969809a62a29072ce1a99806bd3719052a67e Mon Sep 17 00:00:00 2001 From: shinate Date: Thu, 8 Oct 2015 18:44:26 +0800 Subject: [PATCH 13/18] _renderHTML updated, change preloading method --- src/js/iSlider.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/js/iSlider.js b/src/js/iSlider.js index 66dd03f4..d517feaf 100644 --- a/src/js/iSlider.js +++ b/src/js/iSlider.js @@ -794,7 +794,11 @@ this._changedStyles(); - this._initLoadImg(); + // Preload picture [ may be pic :) ] + global.setTimeout(function () { + this._preloadImg(this.slideIndex); + }.bind(this), 200); + // append ul to div#canvas if (!this.outer) { this.outer = outer; @@ -803,11 +807,10 @@ }; /** - * TODO Will be fixed - * preload img when slideChange - * From current index +2, -2 scene - * @param {number} dataIndex means which image will be load - * @private + * Preload img when slideChange + * From current index +2, -2 scene + * @param {number} dataIndex means which image will be load + * @private */ iSliderPrototype._preloadImg = function (dataIndex) { if (this.data.length > 3) { @@ -822,6 +825,7 @@ preloadImg.onload = function () { item.width = preloadImg.width; item.height = preloadImg.height; + console.error(item); }; item.loaded = 1; } From 7b4a6123f09b20030707fd9731d14028690f3b40 Mon Sep 17 00:00:00 2001 From: shinate Date: Fri, 9 Oct 2015 12:53:36 +0800 Subject: [PATCH 14/18] add sipmle parameters support --- src/index.html | 47 +++++++++++---------- src/js/iSlider.js | 105 ++++++++++++++-------------------------------- 2 files changed, 55 insertions(+), 97 deletions(-) diff --git a/src/index.html b/src/index.html index 95edda7c..c6a95b54 100644 --- a/src/index.html +++ b/src/index.html @@ -56,29 +56,30 @@ })() }); - var islider = new iSlider({ - data: list, - dom: document.getElementById("iSlider-wrapper"), - // isVertical: true, - isLooping: 1, - isOverspread: 1, - animateType: 'default', - animateTime: 500, - fixPage: 1, - isDebug: 1, - // isDebug: 0, - // isLoading: true, - // isAutoplay: true, - // duration: 5000, - plugins: ['dot', 'button', ['zoompic', {zoomFactor: 2}]], - onslide: function () { - console.debug(arguments) - }, - onslidechange: function () { - console.debug(arguments, 'Change~ juse one time'); - this.off('slideChange', arguments.callee); - } - }); + var islider = new iSlider( + document.getElementById("(Ō̥̥̥̥̥̥̥ ԑ Ō̥̥̥̥̥̥̥ )"), list, { + // data: list + dom: document.getElementById("iSlider-wrapper"), + // isVertical: true, + isLooping: 1, + isOverspread: 1, + animateType: 'default', + animateTime: 500, + fixPage: 1, + isDebug: 1, + // isDebug: 0, + // isLoading: true, + // isAutoplay: true, + // duration: 5000, + plugins: ['dot', 'button', ['zoompic', {zoomFactor: 2}]], + onslide: function () { + console.debug(arguments) + }, + onslidechange: function () { + console.debug(arguments, 'Change~ juse one time'); + this.off('slideChange', arguments.callee); + } + }); islider.on('slideChange', function () { console.debug('Change event from method "on"', this, arguments); diff --git a/src/js/iSlider.js b/src/js/iSlider.js index d517feaf..650e180f 100644 --- a/src/js/iSlider.js +++ b/src/js/iSlider.js @@ -84,32 +84,29 @@ /** * @constructor * - * @param {Object} opts 参数集 - * @param {Element} opts.dom 外层元素 Outer wrapper - * @param {Array} opts.data 数据列表 Content data + * iSlicer([[{Element} container,] {Array} datalist,] {object} options) + * + * @param {Element} container + * @param {Array} datalist + * @param {Object} options + * + * @description + * options.dom > container + * options.data > datalist */ - var iSlider = function (opts) { - // TODO. Will support simple param - // var iSlider = function (node, data, opts) { - // switch (arguments.length) { - // case 1: - // if (Object.prototype.toString.call(arguments[1]) !== '[object Object]') - // throw new Error('The argument must be an object'); - // case 2: - // if (isArray(arguments[1])) { - // var opts = {}; - // opts.dom = node; - // opts.data = data; - // } else { - // var opts = data; - // opts.dom = opts.dom || node; - // } - // break; - // case 3: - // opts.dom = opts.dom || node; - // opts.data = opts.data || data; - // break; - // } + var iSlider = function () { + + var args = Array.prototype.slice.call(arguments, 0, 3); + if (!args.length) { + throw new Error('Parameters required!'); + } + var opts = args.pop(); + switch (args.length) { + case 2: + opts.data = opts.data || args[1]; + case 1: + opts.dom = opts.dom || args[0]; + } if (!opts.dom) { throw new Error('Container can not be empty!'); @@ -132,8 +129,12 @@ */ this._LSN = {}; + opts = args = null; + this._setting(); - this._renderHTML(); + + this.fire('initialize'); + this._renderWrapper(); this._initPlugins(); this._bindHandler(); }; @@ -143,7 +144,7 @@ * @type {Array} * @protected */ - iSlider.EVENTS = 'slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored reloadData destroy'.split(' '); + iSlider.EVENTS = 'initialize slide slideStart slideEnd slideChange slideChanged slideRestore slideRestored reloadData destroy'.split(' '); /** * Easing white list @@ -317,10 +318,6 @@ */ this.data = opts.data; - // default type - // TODO will be renamed - this.type = opts.type || null; - /** * default slide direction * @type {boolean} @@ -405,9 +402,6 @@ */ this.scale = this.isVertical ? this.height : this.width; - // TODO will be removed - this.isLoading = opts.isLoading; - /** * On slide offset position * @type {{X: number, Y: number}} @@ -760,21 +754,12 @@ * render list html * @private */ - iSliderPrototype._renderHTML = function () { + iSliderPrototype._renderWrapper = function () { this.outer && (this.outer.innerHTML = ''); // initail ul element var outer = this.outer || document.createElement('ul'); outer.className = 'islider-outer'; - // loading - if (this.type === 'pic' && !this.loader && this.isLoading) { - var loader = document.createElement('div'); - loader.className = 'islider-loader'; - this.loader = loader; - this.wrap.appendChild(loader); - this.fire('loading'); - } - // storage li elements, only store 3 elements to reduce memory usage this.els = []; for (var i = 0; i < 3; i++) { @@ -825,7 +810,6 @@ preloadImg.onload = function () { item.width = preloadImg.width; item.height = preloadImg.height; - console.error(item); }; item.loaded = 1; } @@ -836,32 +820,6 @@ } }; - /** - * TODO will be fixed - * load extra imgs when renderHTML - * @private - */ - iSliderPrototype._initLoadImg = function () { - var data = this.data; - var len = data.length; - var idx = this.slideIndex; - var self = this; - - if (this.type === 'pic' && len > 3) { - var nextIndex = (idx + 2 > len) ? ((idx + 1) % len) : (idx + 1); - var prevIndex = (idx - 1 < 0) ? (len - 1 + idx) : (idx - 1); - data[idx].loaded = 1; - data[nextIndex].loaded = 1; - if (self.isLooping) { - data[prevIndex].loaded = 1; - } - - global.setTimeout(function () { - self._preloadImg(idx); - }, 200); - } - }; - /** * Watch event transitionEnd * @private @@ -1222,7 +1180,6 @@ headEl.style.webkitTransition = 'none'; headEl.style.visibility = 'hidden'; - // TODO ??? global.setTimeout(function () { headEl.style.visibility = 'visible'; }, 200); @@ -1405,7 +1362,7 @@ iSliderPrototype.reset = function () { this.pause(); this._setting(); - this._renderHTML(); + this._renderWrapper(); this.isAutoplay && this.play(); }; @@ -1417,7 +1374,7 @@ this.pause(); this.slideIndex = initIndex || 0; this.data = data; - this._renderHTML(); + this._renderWrapper(); this.fire('reloadData'); this.isAutoplay && this.play(); }; From bcf17e67e330391f4d9654aeb0f8565c55e444be Mon Sep 17 00:00:00 2001 From: shinate Date: Fri, 9 Oct 2015 12:58:19 +0800 Subject: [PATCH 15/18] clean up --- .gitignore | 124 ++++++++++++++++++++++++++++++++++++++++++++++++---- gulpfile.js | 7 +-- 2 files changed, 116 insertions(+), 15 deletions(-) mode change 100755 => 100644 .gitignore diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 index fea30456..ce48ebb5 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,118 @@ -.DS_Store -node_modules/ -*.exe -*.sublime-* -output/ -test/ +# Created by .ignore support plugin (hsz.mobi) +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio + +*.iml + +## Directory-based project format: .idea/ -npm-debug.log +# if you remove the above rule, at least ignore the following: + +# User-specific stuff: +# .idea/workspace.xml +# .idea/tasks.xml +# .idea/dictionaries + +# Sensitive or high-churn files: +# .idea/dataSources.ids +# .idea/dataSources.xml +# .idea/sqlDataSources.xml +# .idea/dynamic.xml +# .idea/uiDesigner.xml + +# Gradle: +# .idea/gradle.xml +# .idea/libraries + +# Mongo Explorer plugin: +# .idea/mongoSettings.xml + +## File-based project format: +*.ipr +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +### Eclipse template +*.pydevproject +.metadata +.gradle +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath + +# Eclipse Core +.project + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Java annotation processor (APT) +.factorypath + +# PDT-specific +.buildpath + +# sbteclipse plugin +.target + +# TeXlipse plugin +.texlipse +### Node template +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release +# Dependency directory +# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git +node_modules -/.project -/*.iml diff --git a/gulpfile.js b/gulpfile.js index 72f87fd7..0f839915 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,19 +9,17 @@ var clean = require('gulp-clean'); var CONFIG = { src: './src', demo: './demo/public', - test: './test/public', build: './build' }; gulp.task('clean', function () { - gulp.src([CONFIG.demo + '/*', CONFIG.test + '/*', CONFIG.build + '/*'], {read: false}) + gulp.src([CONFIG.demo + '/*', CONFIG.build + '/*'], {read: false}) .pipe(clean()); }); gulp.task('css', function () { gulp.src([CONFIG.src + '/style/iSlider.css']) .pipe(gulp.dest(CONFIG.demo + '/css')) - .pipe(gulp.dest(CONFIG.test + '/css')) .pipe(gulp.dest(CONFIG.build)) .pipe(cssmin()) .pipe(rename({ @@ -33,7 +31,6 @@ gulp.task('css', function () { gulp.task('iSlider', function () { return gulp.src(['src/js/iSlider.js']) .pipe(gulp.dest(CONFIG.demo + '/js')) - .pipe(gulp.dest(CONFIG.test + '/js')) .pipe(gulp.dest(CONFIG.build)) .pipe(uglify()) .pipe(rename({ @@ -48,7 +45,6 @@ gulp.task('externals', function () { path.basename = "iSlider." + path.basename; })) .pipe(gulp.dest(CONFIG.demo + '/js')) - .pipe(gulp.dest(CONFIG.test + '/js')) .pipe(gulp.dest(CONFIG.build)) .pipe(uglify()) .pipe(rename({ @@ -63,7 +59,6 @@ gulp.task('plugins', function () { path.basename = "iSlider.plugin." + path.basename; })) .pipe(gulp.dest(CONFIG.demo + '/js')) - .pipe(gulp.dest(CONFIG.test + '/js')) .pipe(gulp.dest(CONFIG.build)) .pipe(uglify()) .pipe(rename({ From a079a3b7ad19d893d6e406207ee354becc502c47 Mon Sep 17 00:00:00 2001 From: shinate Date: Fri, 9 Oct 2015 13:28:48 +0800 Subject: [PATCH 16/18] readme updated --- README.md | 19 +++++++++++++++++-- README_Chinese.md | 21 ++++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ce62d523..23a38fe4 100755 --- a/README.md +++ b/README.md @@ -61,6 +61,12 @@ var data = [ #### Initializing a iSlider +``` javascript +var islider = new iSlider(document.getElementById('iSlider-wrapper'), data); +``` + +you can also + ``` javascript var islider = new iSlider({ dom : document.getElementById('iSlider-wrapper'), @@ -68,6 +74,15 @@ var islider = new iSlider({ }); ``` +``` javascript +var islider = new iSlider(document.getElementById('iSlider-wrapper'), data, { + dom : document.getElementById('iSlider-wrapper'), + data : data +}); +``` + +***Options properties precedence over parameters*** + ### Extending iSlider #### Animations @@ -189,8 +204,8 @@ To learn more advanced features, please refer to [WIKI](https://github.com/BE-FE type (Soon abandoned or renamed) - {string} - Sets to `pic` will enable global images preload. Default: null (disabled) + - + - duration diff --git a/README_Chinese.md b/README_Chinese.md index 63c2d0d1..9daf3551 100755 --- a/README_Chinese.md +++ b/README_Chinese.md @@ -58,6 +58,12 @@ var data = [ #### 初始化一个iSlider +``` javascript +var islider = new iSlider(document.getElementById('iSlider-wrapper'), data}); +``` + +也可以 + ``` javascript var islider = new iSlider({ dom : document.getElementById('iSlider-wrapper'), @@ -65,6 +71,15 @@ var islider = new iSlider({ }); ``` +``` javascript +var islider = new iSlider(document.getElementById('iSlider-wrapper'), data, { + dom : document.getElementById('iSlider-wrapper'), + data : data +}); +``` + +***配置对象属性的优先级高于参数*** + ### iSlider 扩展 #### 动画效果 @@ -185,9 +200,9 @@ var data = [{ - type (即将废弃或更名) - {string} - 设置为'pic'将开启全局图图片预加载功能,默认:null(不开启) + type (已废弃) + - + - duration From f6202306b8749e2f1a12b722b96dac4e402d4ac0 Mon Sep 17 00:00:00 2001 From: shinate Date: Tue, 13 Oct 2015 16:50:26 +0800 Subject: [PATCH 17/18] Readme updated --- README.md | 4 +--- README_Chinese.md | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 23a38fe4..9a73e51a 100755 --- a/README.md +++ b/README.md @@ -2,10 +2,8 @@ ![](thumbnails/iSlider-logo.png) -#### [iSlider English Official Page](http://be-fe.github.io/iSlider/index_en.html) #### [iSlider English README](https://github.com/BE-FE/iSlider/blob/master/README.md) -#### [iSlider 中文官网](http://be-fe.github.io/iSlider/index.html) -#### [iSlider Example](http://be-fe.github.io/iSlider/demo/) +#### [iSlider 中文文档](https://github.com/BE-FE/iSlider/blob/master/README_Chinese.md) iSlider is a light-weight, high performance, dependency free, yet cross-platform plugin. diff --git a/README_Chinese.md b/README_Chinese.md index 9daf3551..16e78ec2 100755 --- a/README_Chinese.md +++ b/README_Chinese.md @@ -2,10 +2,8 @@ ![](thumbnails/iSlider-logo.png) -#### [iSlider English Official Page](http://be-fe.github.io/iSlider/index_en.html) #### [iSlider English README](https://github.com/BE-FE/iSlider/blob/master/README.md) -#### [iSlider 中文官网](http://be-fe.github.io/iSlider/index.html) -#### [iSlider Example](http://be-fe.github.io/iSlider/demo/) +#### [iSlider 中文文档](https://github.com/BE-FE/iSlider/blob/master/README_Chinese.md) iSlider是一个轻量且高性能,无任何库依赖的跨平台滑动控件。 From 2b7a973af37c2128d3b9c6c2640362709035b85f Mon Sep 17 00:00:00 2001 From: shinate Date: Tue, 13 Oct 2015 16:55:14 +0800 Subject: [PATCH 18/18] change log updated --- change_log.md | 1 + 1 file changed, 1 insertion(+) diff --git a/change_log.md b/change_log.md index 290d4d4f..566dd63b 100644 --- a/change_log.md +++ b/change_log.md @@ -8,6 +8,7 @@ - Script reference change, adding mode - Remove configure options - useZoom (move to plugins) +- Preload will work in all modes when the frame is automatically recognized as a picture. #### Something new