jQuery(function($) { // =========================================== // SubMenu active // =========================================== var str = location.href.toLowerCase(); $('.nav-active>li>a').each(function() { if (str.indexOf(this.href.toLowerCase()) > -1) { $(".nav-active>li>a.active").removeClass("active"); $(this).addClass("active"); } }); $('li>a.active').parents().each(function() { if ($(this).is('li>a')) { $(this).addClass("active"); } }); // =========================================== // form mail : style 2 // =========================================== $("#formmail-style-2 input.formmail_border[name='add1']").attr('placeholder', 'name'); $("#formmail-style-2 input.formmail_border[name='add2']").attr('placeholder', 'mail'); $("#formmail-style-2 input.formmail_border[name='add3']").attr('placeholder', 'phone'); $("#formmail-style-2 textarea.formmail_textarea_style[name='description1']").attr('placeholder', 'Describe your project'); // =========================================== // ÇÊÅÍ // =========================================== $('.grid-filter a').on('click', function() { $('.grid-filter li').removeClass('activeFilter'); $(this).parent('li').addClass('activeFilter'); var faqSelector = $(this).attr('data-filter'); $faqItems.css('display', 'none'); if (faqSelector != 'all') { $(faqSelector).fadeIn(500); } else { $faqItems.fadeIn(500); } return false; }); // =========================================== // ¸Þ´º¹Ù // =========================================== var lastScrollTop = 0; window.addEventListener("scroll", function(event) { var st = jQuery(this).scrollTop(); if (st > lastScrollTop) { jQuery('#header.sticky-on-scrollup').removeClass('show-sticky-onscroll'); // Down Scroll } else { jQuery('#header.sticky-on-scrollup').addClass('show-sticky-onscroll'); // Up Scroll } lastScrollTop = st; }); // =========================================== // Æ÷Æ®Æú¸®¿À ÇÊÅÍ URL // =========================================== jQuery(window).on('load', function() { var $container = $('#portfolio'); $container.isotope({ transitionDuration: '0.65s' }); function getHashFilter() { var hash = location.hash; // get filter=filterName var matches = location.hash.match(/filter=([^&]+)/i); var hashFilter = matches && matches[1]; return hashFilter && decodeURIComponent(hashFilter); } var isIsotopeInit = false; function onHashchange() { var hashFilter = getHashFilter(); if (!hashFilter && isIsotopeInit) { return; } isIsotopeInit = true; // filter isotope $container.isotope({ filter: hashFilter }); // set selected class on button if (hashFilter) { $('.grid-filter li').removeClass('activeFilter'); $('.grid-filter li').find('[data-filter="' + hashFilter + '"]').parent('li').addClass('activeFilter'); } } $(window).on('hashchange', onHashchange); // trigger event handler to init Isotope onHashchange(); $('.grid-filter a').click(function() { $('.grid-filter li').removeClass('activeFilter'); $(this).parent('li').addClass('activeFilter'); var selector = $(this).attr('data-filter'); $container.isotope({ filter: selector }); var filterAttr = $(this).attr('data-filter'); location.hash = 'filter=' + encodeURIComponent(filterAttr); return false; }); }); });