开发者

jquery: dblclick link call - browser back button doesn't work?

开发者 https://www.devze.com 2023-01-23 22:19 出处:网络
hey guys, what am i doing wrong. i have kind of folders on my website that work with a doubleclick. However somehow my window.location.replace doesn\'t kind of trigger the browser history.

hey guys, what am i doing wrong. i have kind of folders on my website that work with a doubleclick. However somehow my window.location.replace doesn't kind of trigger the browser history.

if i use normal click without prevent default, i can use the browser back button. however as soon as i use the script underneath and i doubleclick on a folder i cannot use the browser back button.

$('.folder a').click(function(e) {
    e.preventDefault(开发者_StackOverflow社区);
});

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

any idea?


This site says the replace wont add to history.

Try:

window.location.href =$(this).attr("href");
0

精彩评论

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