This is an answer to How to bind jQuery History state dynamically in .click()?
Last active
September 5, 2015 15:54
-
-
Save balupton/515814 to your computer and use it in GitHub Desktop.
Answer: How to bind jQuery History state dynamically in .click()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Attach event to reference nav. | |
$("#refnav A").each(function(a,b) { | |
var $b = $(b), | |
href = $b.attr("href"); | |
$.History.bind(href,function(state){ | |
loadMenu("diagram",state); | |
}); | |
$b.click(function(event){ | |
event.preventDefault(); | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Attach event to reference nav. | |
$("#refnav A").each(function(a,b) { | |
$(b).click(function(){ | |
href = $(b).attr("id"); | |
$.History.bind(href,function(state){ | |
loadMenu("diagram",href); | |
}); | |
return false; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment