/* Author Adam Zabinski WSI-Internetmarketing.co.uk */ //Responsive Navigation setup var ww = document.body.clientWidth; $(window).load(function () { $("#dnn_pnav li a").each(function () { if ($(this).next().length > 0) { $(this).addClass("parent"); }; }) $("#dnn_pnav li.hover a.parent").each(function () { $(this).bind('click'); }) $(".toggleMenu").click(function (e) { //toggle mobile navigation e.preventDefault(); $(this).toggleClass("active"); $("#dnn_pnav").toggle(); }); adjustMenu(); if (document.documentElement.clientWidth < 800) { $(".topBGImage").remove(); // remove wide background "http://www.wsiworld.com/Portals/0/Skins/WSIWorld/js/" from the devices with the screen resolution < 800px } //Home Zooming divs if (document.documentElement.clientWidth > 720) { $(".img a .inner").hover(function () { $(".img a .inner").removeClass("hovered").stop().animate({ height: "120", marginTop: "0", marginBottom: "0" }, 100); // stop preloading $(this).closest(".img").css("z-index", 1); $(this).animate({ height: "150", marginTop: "-15", marginBottom: "-15" }, "fast"); $(this).children(".inner p").fadeIn(); $(this).addClass("hovered"); }, function () { $(this).closest(".img").css("z-index", 0); $(this).animate({ height: "120", marginTop: "0", marginBottom: "0" }, "fast"); $(".inner p").css("display", "none"); $(this).removeClass("hovered"); }); } $(".button").prepend("» "); // add a symbol to the button //height of the persistent header //if (document.documentElement.clientWidth > 1024) { // var $pHeader = $(".topBG").height(); // $(".TopContent").css("marginTop", $pHeader); // $(".TopSection").css("marginTop", $pHeader); //} //Latest News Section $("a#CSControl").addClass("Active"); $(function () { $("a#CSControl").click(function () { $(".latestNews").hide(); $(".marketingTrends").hide(); $(".caseStudies").fadeIn(); $("a#MTControl").removeClass(); $("a#NUControl").removeClass(); $(this).toggleClass("Active"); }); $("a#NUControl").click(function () { $(".latestNews").fadeIn(); $(".marketingTrends").hide(); $(".caseStudies").hide(); $("a#MTControl").removeClass(); $("a#CSControl").removeClass(); $(this).toggleClass("Active"); }); $("a#MTControl").click(function () { $(".latestNews").hide(); $(".marketingTrends").fadeIn(); $(".caseStudies").hide(); $("a#CSControl").removeClass(); $("a#NUControl").removeClass(); $(this).toggleClass("Active"); }); }); }) // End of doc ready function $(window).bind('resize orientationchange', function () { ww = document.body.clientWidth; adjustMenu(); }); var adjustMenu = function () { if (ww < 560) { $(".toggleMenu").css("display", "inline-block"); if (!$(".toggleMenu").hasClass("active")) { $("#dnn_pnav").hide(); } else { $("#dnn_pnav").show(); } $("#dnn_pnav li").unbind('mouseenter mouseleave'); $("#dnn_pnav li a.parent").unbind('click').bind('click', function (e) { // must be attached to anchor element to prevent bubbling e.preventDefault(); $(this).parent("li").toggleClass("hover"); $(this).unbind('click').click() }); } else if (ww >= 560) { $(".toggleMenu").css("display", "none"); $("#dnn_pnav").show(); $("#dnn_pnav li").removeClass("hover"); $("#dnn_pnav li a").unbind('click'); $("#dnn_pnav li").unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function () { // must be attached to li so that mouseleave is not triggered when hover over submenu $(this).toggleClass('hover'); }); } } // Top Dropdwon Sections function DropDown(el) { this.dd = el; this.initEvents(); } DropDown.prototype = { initEvents: function () { var obj = this; obj.dd.on('click', function (event) { $(this).toggleClass('active'); event.stopPropagation(); }); } } function DropDown(el) { this.dc = el; this.initEvents(); } DropDown.prototype = { initEvents: function () { var obj1 = this; obj1.dc.on('click', function (event) { $(this).toggleClass('active'); event.stopPropagation(); }); } } $(function () { var dd = new DropDown($('#INT')); var dc = new DropDown($('#ContactExpert')); $(document).click(function () { // all dropdowns $('.wrapper-dropdown-1').removeClass('active'); $('.wrapper-dropdown-2').removeClass('active'); }); });