(function($) { $(document).ready(function() { var clicked = false; // Turn projects categories into permalinks by adding hash to URL if (window.location.hash != '') { console.log("hash = "+window.location.hash); $('ul#filters > li > a').each(function() { var option = $(this).attr('data-option-value').replace('.', '#'); if (window.location.hash === option) { $(this).trigger('click'); clicked = true; } }); } if (!clicked) { // set 'all' to active if there is no hash $('ul#filters li a[data-option-value=".all"]').addClass('selected').trigger('click'); } $('ul#filters li a').click(function(){ var hashh = $(this).attr('data-option-value'); hashh = hashh.replace('.',''); window.location.hash = hashh; console.log(":::"+window.location.hash); }); $('ul.menu li a').click(function(){ console.log(":::"+window.location.hash); }); $('div.flexslider ul iframe').each(function() { console.log($(this)); $(this).on('play', function(){ console.log('clicked'); }); }) }); })(jQuery);