jQuery(function() { var $ = jQuery; $('body').addClass('postload'); // start blog page layout $(document).ready(function() { if ($('body').hasClass('wsite-blog-index')) { $('.blog-post .blog-separator, .blog-post .blog-post-separator, .blog-post .blog-social, .blog-post .blog-comments-bottom, .blog-post .blog-read-more, .blog-header .blog-comments').remove(); $('.blog-post').each(function(index) { $(this).prepend($(this).find('.wsite-image:first')); $(this).find('.wsite-image:gt(0)').remove(); $(this).append($(this).find('.blog-date')); $(this).find('td.wsite-multicol-col').has('div:empty').remove(); var postLink = ($(this).find('a.blog-title-link')).attr('href'); $(this).wrapInner(''); //console.log( index + "emptytd: " + emptytd.html() ); }); } else if ($('body').hasClass('wsite-blog-post')) { } }); // end blog page layout $(document).ready(function() { // Start directional hover feature if ($().hoverdir) { $('.hoverdir .item').each(function() { $(this).hoverdir(); }); $('.hd-item').each(function() { $(this).hoverdir(); }); } // /End directional hover feature // General styling $('.wsite-form-radio-container, .wsite-com-product-option-dropdown, .wsite-com-product-option-radio').jqTransform(); // --------------------------------------------------------------------------------------// // Sticky Nav Collapse $('body:not(.splash-page)').waypoint(function() { $(this).toggleClass('collapse'); }, { offset: -150 }); $('body:not(.splash-page) #main-content, #navmobile').css({"padding-top" : $("#header-wrap").height() + "px"}); // --------------------------------------------------------------------------------------// // Add fullwidth class to gallery thumbs if less than 6 $('.imageGallery').each(function(){ if ($(this).children('div').length <= 6) { $(this).children('div').addClass('fullwidth-mobile'); } }); // --------------------------------------------------------------------------------------// // Add current class to store gallery thumb $("#wsite-com-product-images-strip a:first").addClass("current"); $("#wsite-com-product-images-strip a").click(function(){ $(".current").removeClass("current"); $(this).addClass("current"); }); // --------------------------------------------------------------------------------------// // Add swipe to fancybox mobile var swipeGallery = function(){ setTimeout(function(){ var touchGallery = document.getElementsByClassName("fancybox-wrap")[0]; var mc = new Hammer(touchGallery); mc.on("panleft panright", function(ev) { if (ev.type == "panleft") { $("a.fancybox-next").trigger("click"); } else if (ev.type == "panright") { $("a.fancybox-prev").trigger("click"); } swipeGallery(); }); }, 500); }; if ($(window).width() < 1024) { $("body").on( "click", "a.w-fancybox", function() { swipeGallery(); }); } // --------------------------------------------------------------------------------------// // Watch for changes on non-mobile nav if ($(window).width() < 768) { var mainNav = '#nav', mobileNav = "#navmobile"; $(mainNav).on('DOMSubtreeModified propertychange', function() { $(mainNav + " li a").each(function(){ // Differentiating post-load nav elements by the presence of an id if ($(this).attr("id") && $(this).attr("id") != "wsite-nav-cart-a") { var navLinkId = $(this).attr("id"); var navLinkParent = $(this).parent().detach(); // Append to mobile nav if new element if (!$(mobileNav + " #"+navLinkId).length) { $(mobileNav + " .wsite-menu-default").append(navLinkParent); var newheight = $(mobileNav + " .wsite-menu-default").height(); $(".wsite-mobile-menu").height(newheight); } } }); }); } // --------------------------------------------------------------------------------------// $(document).ready(function widg_accordion() { $(".accordion").each(function () { var $initialIndex = $(this).attr('data-initialIndex'); if ($initialIndex == undefined) { $initialIndex = 0; } $(this).tabs("div.accordion-content", { tabs: '.accordion-title', effect: 'slide', initialIndex: $initialIndex }); }); }); // --------------------------------------------------------------------------------------// $(window).ready(function() { /*var slide1 = $('#slide1 img').attr('src'); var slide2 = $('#slide2 img').attr('src'); var slide3 = $('#slide3 img').attr('src'); var slide4 = $('#slide4 img').attr('src'); $('img#t1').attr('src',slide1); $('img#t2').attr('src',slide2); $('img#t3').attr('src',slide3); $('img#t4').attr('src',slide4); $('#slide1 img').attr('data-thumb','slide1'); $('#slide2 img').attr('data-thumb','slide2'); $('#slide3 img').attr('data-thumb','slide3'); $('#slide4 img').attr('data-thumb','slide4');*/ $('#flexslider').flexslider({ controlNav: 'thumbnails' }); /*$('#carousel').flexslider({ controlNav: false, directionNav: false, slideshow: true, minItems: 4, itemWidth: 90, itemMargin: 6, asNavFor: '#flexslider', sync: '#flexslider' });*/ }); $(document).ready(function () { $(".flex-direction-nav").hide(); $(".slider-container").hover( function () { $(".flex-direction-nav").fadeToggle(); }); $('.testi-slider.flexslider').flexslider({ animation: "fade" }); }); // --------------------------------------------------------------------------------------// }); });