我怎么能说..
On Click .not.first() div
alert('Yeah you clicked a div which is not the first one!');
我的实际代码:
this.$('thumbnails').children().click(function() {
$('#video').animate({width: 164, height: 20, top: 475, marginLeft: 262},0)
$('.flv').animate({left: 2222, opacity: '0'},0).css('display', 'none')
$('.close').animate({opacity: '0'},0)
clicked = 0
});
最佳答案
有一个 :gt()
(大于索引的选择器)选择器或 .slice(1)
(@ bobince的首选项:),您的问题的字面翻译为:
$("div:gt(0)").click(function() {
alert('Yeah you clicked a div which is not the first one!');
});
//or...
$("div").slice(1).click(function() {
alert('Yeah you clicked a div which is not the first one!');
});
对于您的更新问题:
$('thumbnails').children(":gt(0)").click(function() {
$('#video').css({width: 164, height: 20, top: 475, marginLeft: 262});
$('.flv').css({left: 2222, opacity: '0'}).hide();
$('.close').css({opacity: '0'});
clicked = 0;
});
//or...
$('thumbnails').children().slice(1).click(function() {
$('#video').css({width: 164, height: 20, top: 475, marginLeft: 262});
$('.flv').css({left: 2222, opacity: '0'}).hide();
$('.close').css({opacity: '0'});
clicked = 0;
});
请注意使用
.css()
,如果您想立即进行非动画样式更改,请使用此代替。关于javascript - jQuery-不是第一,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4304587/