The purpose of this framework is to make it easy to build single page applications using Hash Tags. (It current requires JQuery 1.3.7+).
For example, every Anchor link clinked (<a href=”#goober”…) will fire an event controler.goober() (if it exists). More to come later…
Example of ILOVEHASH
<script langauage="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script language="javascript" src="http://js.icorbin.com/ilovehash/0.5/ilovehash.min.js"></script>
<script language="javascript">
var controller = {
questions:function() {
alert("Showing questions!");
},
answers:function() {
alert("Showing Answers");
}
}
$(document).ready(function() {
ilovehash.init(controller);
$(window).hashchange( function(){
// Alerts every time the hash changes!
ilovehash.init(controller);
});
// Trigger the event (useful on page load).
$(window).hashchange();
});
</script>
<a href="#questions">Questions</a> OR <a href="#answers">Answers</a>
