开发者

jquery: open link on doubleclick?

i wonder if 开发者_开发技巧this is the best solution?

    $('.folder a').click(function(e) {
  e.preventDefault();
});

$('.folder a').dblclick(function(e) {
    window.location.replace($(this).attr("href"));
});

it's working! would you do it in a different manner?


Nope that's perfect.


What you're doing works and is fine technically.

The issue is with the UI. Double-clicking on a hyperlink is not intuitive behaviour. Particularly when disabling the click behaviour. I would suggest a more intuitive UI.


Yes, a slightly different manner.

$('.folder a').click(function(e) {
    e.preventDefault();
}).dblclick(function() {
    window.location.replace($(this).attr("href"));
});

Actually I'd use .on('click') and .on('dblclick') but in either case they would be chained as above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜