When URL changes on scroll to a certain hash, add a class to a div

My URL hash changes on scroll from http://www.website.com#section–1 http://www.website.com#section–2 http://www.website.com#section–3 and so on. It’s a fullpage-scrolling effect. What I want to do is to add the class .draw-shirt to the div #shirt when the URL changes on scroll to #section–2. I tried this code: $(document).ready(function () { if (window.location.href.indexOf("emotion–2") > -1) { $(‘#shirt’).addClass(‘draw-shirt’); } });… Read More When URL changes on scroll to a certain hash, add a class to a div