toggle on double click
looking a way to make a toggle on doubleclick, this is my code:
$('#mydiv'开发者_Go百科).toggle(function() {
$('#post').css({'height' : '188'});
}, function() {
$('#post').css({'height' : '48'});
});
$('#mydiv').dblclick(function () {
$('#post').height($('#post').height() > 100 ? 48 : 180);
});
Or may be you want this:
$(".generic-expand-button").each(function () {
$(this).dblclick(function() {
$(this).closest(".post").height($(this).closest(".post").height() > 100 ? 48 : 180);
});
});
Use jQuery double click event: http://api.jquery.com/dblclick/
精彩评论