/ Published in: JavaScript

Show alternative views of your page, depending on a hashtag
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* URL sample: http://bla.com/#altview */ var altviews = { hashTagTrigger : function(){ var hash = location.hash; if(hash){ var hash = hash.replace(/^#/, ''); if(this[hash]) this[hash].init(); } }, altview : { init : function(){ this.css(); this.js(); }, css : function(){ $('body').addClass('alt-view'); }, js : function(){ } }, altview1 : { init : function(){ // Do something } } } altviews.hashTagTrigger();
Comments
