jquery-这段代码的详细解析(初学者,看的晕晕的)谢谢

问题描述

这段代码的详细解析(初学者,看的晕晕的)谢谢

/**
?**公用滚动方法
?**???? 支持定时自动轮播、前后轮播、单独点击轮播
?**/
(function($){
?
$("div[data-scro='controler'] b,div[data-scro='controler2'] a").click(function(){
?
var T = $(this);
if(T.attr("class")=="down") return false;
J2ROLLING_ANIMATION.st({
?
findObject : T,//当前点击对象 默认写
main : T.parent().parent().find("div[data-scro='list']"),//滚动目标容器窗口对象
pagSource : T.parent().parent().find("div[data-scro='controler'] b"),//切换按钮对象
className : "down",//选中的样式
duration : "slow",//滚动速度 和jquery速度一致
on : $(this)[0].tagName=="A" ? true : false//用于判断是否开启无限滚动 or 来回切换
?
});
return false;
?
});
var J2SETTIME="", J2Time=true,J2ROLLING_ANIMATION = {
?
init : function(){
?
this.start();
this.time();
?
},
st : function(o){
?
if(J2Time){
?
this.animate(o.findObject,o.main,o.className,o.duration,o.pagSource,o.on);
J2Time = false;
?
}
?
},
animate : function(T,M,C,S,P,O){
?
var _prevDown = O ? P.parent().find("*[class='"+C+"']") : T.parent().find(T[0].tagName+"[class='"+C+"']"),
_prevIndex = _prevDown.index(),
_thisIndex = O ? (T.attr("class")=="next" ? _prevIndex+1 : _prevIndex-1) : T.index(),
_list = M.find(".item"),
p2n = 1;
_prevDown.removeClass(C);
if(O){
?
if(_thisIndex==-1) _thisIndex=_list.size()-1;
if(_thisIndex==_list.size()) _thisIndex=0;
P.eq(_thisIndex).addClass(C);
?
}else{
?
T.addClass(C);
?
}
if(T.attr("class")=="prev" || _thisIndex<_prevIndex) p2n = false;
if((T.attr("class")=="next" || _thisIndex>_prevIndex)&&T.attr("class")!="prev") p2n = true;
?
!p2n ? _list.eq(_thisIndex).css("left",-M.width()) : '';
_list.eq(_prevIndex).animate({
left:p2n ? -M.width() : M.width()
},S,function(){
?
$(this).removeAttr("style");
J2Time = true;
?
});
_list.eq(_thisIndex).animate({
left:"0px"
},S);
?
},
start : function(){
?
$("#section-focus-pic div[data-scro='controler'] b,#section-focus-pic div[data-scro='controler2'] a").mouseover(function(){
?
window.clearInterval(J2SETTIME);??
?
}).mouseout(function(){
?
J2ROLLING_ANIMATION.time();
?
});
?
},
time : function(){
?
J2SETTIME = window.setInterval(function(){
?
var num = $("#section-focus-pic div[data-scro='controler'] b[class='down']").index(),
_list = $("#section-focus-pic div[data-scro='list'] li");
_list.eq(num).animate({
"left":-$("#section-focus-pic div[data-scro='list']").width()
},"slow",function(){
?
$(this).removeAttr("style");
$("#section-focus-pic div[data-scro='controler'] b").removeClass("down").eq(num).addClass("down");
?
});
num++;
if(num==_list.size()){
?
num=0;
?
}
_list.eq(num).animate({
"left":"0px"
},"slow");
?
},4000);
?
}
?
};
$("a").click(function(){
?
$(this).blur();?
?
});
?
J2ROLLING_ANIMATION.init();//是否开启自动轮播
?
})(this.jQuery || this.baidu);

解决方案

写的好复杂,看不懂,是要做轮播图吗?有很多方法:http://blog.csdn.net/qq_19558705/article/details/49851879

解决方案二:

这段代码是要批判的。。

时间: 2024-08-03 17:42:40

jquery-这段代码的详细解析(初学者,看的晕晕的)谢谢的相关文章

编码-下面的这段代码什么意思,帮忙看一下,谢谢!!!

问题描述 下面的这段代码什么意思,帮忙看一下,谢谢!!! void BianMa(MyTreeNode* mtns[]) { MyTreeNode* curr; string codes; char* code = new char[size]; for (int i = 0; i < size; i++) { code[i] = '2'; } for (int i = 0; i < size; i++) { int j = 1; cout<<mtns[i]->data<

android小白请教一段代码的详细解释。。非常感谢

问题描述 android小白请教一段代码的详细解释..非常感谢 代码如下 private String read(){ try{ FileInputStream fis=openFileInput(FILE_NAME); byte[] buff=new byte[1024]; int hasRead=0; StringBuilder sb=new StringBuilder(""); while ((hasRead=fis.read(buff))>0){ sb.append(ne

redirect-求大神帮忙解释下面这段代码,尤其是问号后边的,谢谢啦

问题描述 求大神帮忙解释下面这段代码,尤其是问号后边的,谢谢啦 求大神帮忙解释下面这段代码,尤其是问号后边的,谢谢啦 <result type="redirect" name="success">/Module/QuZhengGuiZe/List.action?pageLink=${pager.pageLinkUrl}</result> 解决方案 返回结果为success url地址重定向( type="redirect"

JQuery入门—JQuery程序的代码风格详细介绍_jquery

<jQuery权威指南>第1章jQuery开发入门,本章通过循续渐进的方式,先从jQuery的基础概念入手,介绍jQuery库的下载,引入简单应用方法:后部分侧重于jQuery控制DOM对象和页面CSS样式的介绍,通过一些简单的小示例,使读者对jQuery在页面中的功能应用有一个大致的了解,为下一章节进一步学习jQuery库的详细对象和方法奠定基础.本节为大家介绍jQuery程序的代码风格.  1.1.5 jQuery程序的代码风格 1."$"美元符的使用 在jQuery程

请大家翻译一下这段代码的意思,菜鸟看不懂!

问题描述 amespaceSky.Decrypt{usingSystem;usingSystem.IO;usingSystem.Runtime.Serialization;usingSystem.Runtime.Serialization.Formatters.Binary;usingSystem.Security.Cryptography;usingSystem.Text;publicclassDecryption{privatestringtemporaryFileName=Path.Com

这段代码,大家帮我看看出了什么问题

问题描述 privatevoidbutton1_Click(objectsender,EventArgse){title[0]="请你选择你原数据文件.";title[1]="请你选择你新数据文件.";for(inti=0;i<2;i++){OpenFileDialogopenFileDialog1=newOpenFileDialog();openFileDialog1.Title=title[i];stringdir=@"D:";open

【紧急】求一段代码的详细意思

问题描述 每一段的详细意思,拜托各位高手了<%@pagecontentType="text/html;charset=gb2312"%><%@pagelanguage="java"%><%@pageimport="java.sql.*"%><jsp:useBeanid="td_pjm"class="td.personaljob"/><jsp:useBea

jquery中的过滤操作详细解析_jquery

1.过滤 Filtering 名称 说明 举例 eq( index ) 获取第N个元素 获取匹配的第二个元素: $("p").eq(1) filter( expr ) 筛选出与指定表达式匹配的元素集合. 保留带有select类的元素: $("p").filter(".selected") filter( fn ) 筛选出与指定函数返回值匹配的元素集合 这个函数内部将对每个对象计算一次 (正如 '$.each'). 如果调用的函数返回false则这

急求基于文本文件的全文检索代码,详细内容请看里面

问题描述 基于文本文件的全文检索有多个英文文本文件(文件名也都是英文,形式为filename.txt),另给出search.txt文件中的每一行为一个检索请求.每个检索请求可能为一个或者多个英文单词,单词间以空格分隔.根据每行的检索请求查找出这些单词都在那些文本文件中存在.并输出至result.txt.性能将是考虑因素.1.实现的检索引擎仅支持英文,且严格区分大小写,中文及任何非英文字符均为非正常字符.2.一个检索请求中多个单词代表"AND",当被检索文件中包含全部请求中的单词时才能被