Tom*_*kay 17 javascript jquery
我怎么能说..
On Click .not.first() div
alert('Yeah you clicked a div which is not the first one!');
Run Code Online (Sandbox Code Playgroud)
我的实际代码:
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
});
Run Code Online (Sandbox Code Playgroud)
Nic*_*ver 47
有一个: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!');
});
Run Code Online (Sandbox Code Playgroud)
对于您更新的问题:
$('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;
});
Run Code Online (Sandbox Code Playgroud)
注意使用.css(),如果要进行即时非动画样式更改,请使用此istead.
$(div).not(":first").click(function(){
alert("Yeah you clicked a div which is not the first one!);
});
Run Code Online (Sandbox Code Playgroud)
$('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
});
Run Code Online (Sandbox Code Playgroud)
将是您的问题更新的答案.
$("#id").not(':first').click(function(){
alert('Not the first');
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25736 次 |
| 最近记录: |