/ Published in: jQuery
Uses jquery and raw javascript to quickly add a class to the body class depending on what kind of page it is.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* * Body switcher class for Volusion * by Chris J. Lee * 2009 */ $(document).ready(function() { var loc = $()[0].location.href; var loc = $()[0].location.href; var c = loc.length-1; // String Count if (loc[c] == '/') { $('body').addClass('homepage'); } else { $('body').addClass('sub'); } if (loc.match('default\.asp')) $('body').addClass('home'); if (loc.match('-p/') || loc.match('ProductDetails\.asp')) $('body').addClass('product'); if (loc.match('-s/')) $('body').addClass('category'); if (loc.match('-a/') || loc.match('article\.asp\?')) $(body).addClass('article'); if (loc.match('shoppingcart\.asp')|| loc.match('one-page-checkout\.asp')) $('body').addClass('shoppingcart'); if (loc.match('returns\.asp')) $('body').addClass('article return'); if (loc.match('aboutus\.asp')) $('body').addClass('article aboutus'); });
URL: hire.chrisjlee.net