【发布时间】:2011-03-06 17:54:50
【问题描述】:
我有一个与我之前的文章有关的问题css, button selection and html tags
如果有人能提供一些关于我要去哪里的见解的话,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)});
};
});});
【问题讨论】:
-
如果您只发布自己的 javascript,帮助您会容易得多。 jQuery 源不是必需的。
标签: javascript asp.net html