;(function($){ //个人插件 start $.fn.extend({ /** * 功能介绍:文字若图片单向上下滑动 * 参数介绍: * ns: 默认为 3000,选填项 * auto: 默认为 true,选填项 * s: 默认为 380,选填项 *--------------------------------------- * Update: 2015.8.19 */ 'upAndDown':function(options){ p_this=$(this); //设置默认值 $.extend合并新参数 options=$.extend({ ns:3000, auto:true, s:380 },options); var notConf=$.extend({ l:p_this.find("[role='left']"), //左按钮 r:p_this.find("[role='right']"), //右按钮 v:p_this.find("[role='view']"), //可视区域 m:p_this.find("[role='move']") //可移动目标 },options); var h=notConf.m.children().height(), len=notConf.m.children().length; notConf.m.height(h*len); var cl=null,cr=null; var t=notConf.m.position().top; notConf.r.click(function(){ if(!notConf.m.is(':animated')){ t=notConf.m.position().top; if(t<0){ notConf.m.animate({top:'+='+h+'px'},notConf.s); } } }); notConf.l.click(function(){ if(!notConf.m.is(':animated')){ t=notConf.m.position().top; if(h-h*len