[英]jquery problem on tab selection
我有一个与我以前的文章css,按钮选择和html标签相关的问题
使用javascript不是很好,如果任何人可以提供一些洞察我去哪里。
感谢任何能提供帮助的人
$(function() {
$('input.field').
focus(function() {
if(this.title==this.value) {
this.value = '';
}
}).
blur(function(){
if(this.value=='') {
this.value = this.title;
}
});
var currentPage = 1;
$('#slider .buttons span').live('click', function() {
var timeout = setTimeout(function() {$("img").trigger("slidermove")}, 300);
var fragments_count = $(this).parents('#slider:eq(0)').find('.fragment').length;
var fragmet_width = $(this).parents('#slider:eq(0)').find('.fragment').width();
var perPage = 1;
var numPages = Math.ceil(fragments_count/perPage);
var stepMove = fragmet_width*perPage;
var container = $(this).parents('#slider:eq(0)').find('.content');
var firstPosition = 0;
var lastPosition = -((numPages-1)*stepMove);
if ($(this).hasClass('next')) {
currentPage ++;
if (currentPage > numPages) {
currentPage = 1;
container.animate({'left': firstPosition});
return;
};
container.animate({'left': -((currentPage - 1)*stepMove)});
};
if ($(this).hasClass('prev')) {
currentPage --;
if (currentPage < 1) {
currentPage = numPages;
container.animate({'left': lastPosition});
return;
};
container.animate({'left': -((currentPage-1)*stepMove)});
};
});});
您的描述中的jQuery代码是最小化版本。 如果从他们的站点下载jQuery,您将看到.min.js文件和标准.js文件。 拳头占用的空间较少,第二个是可读源。 你有第一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.