i'm trying change element's css when url has hash in it.
url looks like
http://foo.com/base/something#item-itemid the static part in url #item- bit. something , itemid bits change. whenever url has #item (dash omitted on purpose) in i'd change
<ul class="side"> into
<ul class="side hashed"> after creating specific class case managed compile piece of js code based on poor understanding of js , jquery add class element:
$(function() { var loc = window.location.hash; if(/^#item/.test(loc)) { $('ul.side').addclass('hashed'); } }); but doesn't work.
please help.
suggestions in right direction appreciated.
if (window.location.hash.split('-')[0] == '#item') { $('ul.side').addclass('hashed'); }
Comments
Post a Comment