我怎么能说..
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
});
发布于 2010-11-29 22:19:14
有一个:gt()
(大于索引)选择器或.slice(1)
(@bobince's preference :),您的问题按字面意思翻译为:
$("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()
的用法,如果你想进行即时的非动画样式更改,请使用此选项。
发布于 2010-11-29 22:19:20
$(div).not(":first").click(function(){
alert("Yeah you clicked a div which is not the first one!);
});
$('thumbnails').children().not(":first").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
});
将是对您的问题的更新的答案。
发布于 2010-11-29 22:19:15
$("#id").not(':first').click(function(){
alert('Not the first');
});
https://stackoverflow.com/questions/4304587
复制相似问题