Volusion with Jquery Body Switcher Script


/ Published in: jQuery
Save to your folder(s)

Uses jquery and raw javascript to quickly add a class to the body class depending on what kind of page it is.


Copy this code and paste it in your HTML
  1. /*
  2.  * Body switcher class for Volusion
  3.  * by Chris J. Lee
  4.  * 2009
  5. */
  6.  
  7. $(document).ready(function() {
  8. var loc = $()[0].location.href;
  9. var loc = $()[0].location.href;
  10. var c = loc.length-1; // String Count
  11. if (loc[c] == '/') { $('body').addClass('homepage'); }
  12. else {
  13. $('body').addClass('sub');
  14. }
  15. if (loc.match('default\.asp')) $('body').addClass('home');
  16. if (loc.match('-p/') || loc.match('ProductDetails\.asp')) $('body').addClass('product');
  17. if (loc.match('-s/')) $('body').addClass('category');
  18. if (loc.match('-a/') || loc.match('article\.asp\?')) $(body).addClass('article');
  19. if (loc.match('shoppingcart\.asp')|| loc.match('one-page-checkout\.asp')) $('body').addClass('shoppingcart');
  20. if (loc.match('returns\.asp')) $('body').addClass('article return');
  21. if (loc.match('aboutus\.asp')) $('body').addClass('article aboutus');
  22. });

URL: hire.chrisjlee.net

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.