$('#ajax-links a').live('click', function(e) {
var url = $(this).attr('href');
url = url.replace(/^.*#/, '');
$.history.load(url);
return false;
});
Whenever I replace ‘click’ with ‘dblclick’ it still behaves as the click event. The demo is here (http://www.serpere.info/jquery-history-plugin/samples/ajax/) and the source can be download from here : https://github.com/tkyk/jquery-history-plugin/tree/master/samples/
Try prevent default on single click when adding dblclick:
Instead of
return false;you can prevent the default action for the event:If you don’t want the event to bubble throw the DOM you can use the
event.stopPropagation()functionDblclick events only gets fired at dblclick: see: jsfiddle.net/cR5ZS
The reason you think its get fired on single click can be that your link refers to something like:
#/some_page/and your dblclick event handler does almost the same. Saves/some_page/with$.historyplugin and in my experience the $.history plugin does almost the same: takes the url parsed to with the call and puts it in the hash : url=/some_page/becomes#/some_page/Andreas