1(function ($) { 2 $(function () { 3 4 /** Trigger Menu stretch */ 5 if ($(".wpfm-nav-strech-trigger")[0] && ($(".wpfm-nav-strech-trigger").attr('id') == 'right' 6 || $(".wpfm-nav-strech-trigger").attr('id') == 'left')) { 7 $('.wpfm-nav-strech-trigger').click(function (e) { 8 e.preventDefault(); 9 $('.wpfm-nav-strech-trigger').hide(); 10 $('ul.wpfm-nav-show-hide').slideToggle(400); 11 }); 12 } 13 14 /** Trigger Menu close */ 15 if ($(".wpfm-nav-close-trigger")[0] && ($(".wpfm-nav-close-trigger").attr('id') == 'right' 16 || $(".wpfm-nav-close-trigger").attr('id') == 'left')) { 17 $('.wpfm-nav-close-trigger').click(function (e) { 18 e.preventDefault(); 19 $('.wpfm-nav-strech-trigger').show(); 20 $('ul.wpfm-nav-show-hide').slideUp(400); 21 }); 22} 23 24/** On hover effect for template 7 */ 25$(".wpfm-menu-name").hover(function () { 26 $(this).find('.wpfm-tootltip-title').css('opacity', '1'); 27}); 28 29 /** 30 Add no-touch class to body for mobile touch events 31 Hover toggle for touch activated 32 */ 33 34 if($('body').find('.wpfm-menu-wrapper').attr('data-disable-double-touch') !== '1'){ 35 var clickBtn = true; 36 if ("ontouchstart" in document.documentElement) { 37 /* Add wpfm-touch class to the document html */ 38 document.documentElement.className += " wpfm-touch"; 39 var container = $('#wpfm-floating-menu-nav ul li a, #wpfm-floating-menu-nav ul li.wpfm-modal-popup-link a, #wpfm-floating-menu-nav ul li a[href^="#"]'); 40 41 /* Prevent First click on menu if touch device */ 42 $(document).on('click', '#wpfm-floating-menu-nav ul li a, #wpfm-floating-menu-nav ul li.wpfm-modal-popup-link a, #wpfm-floating-menu-nav ul li a[href^="#"]', function (e) { 43 container.not(this).removeClass('wpfm_hover_effect'); 44 $(this).toggleClass('wpfm_hover_effect') 45 if($(this).hasClass('wpfm_hover_effect')){ 46 e.preventDefault(); 47 }else{ 48 } 49 }); 50 51 52 /** 53 * if the target of the click isn't the container nor a descendant of the container 54 */ 55 $(document).mouseup(function (e){ 56 if (!container.is(e.target) 57 && container.has(e.target).length === 0){ 58 container.removeClass('wpfm_hover_effect'); 59 } 60}); 61 } 62} 63 64/** Initialize active class for on scroll event */ 65if ($('.wpfm-floating-wh-wrapper a[href^="#"]').length > 0) { 66 $(document).on("scroll", onScroll); 67} 68 69/** Inline Navigation Js */ 70$('.wpfm-floating-wh-wrapper a[href^="#"]').on('click', function (e) { 71 e.preventDefault(); 72 var target = $(this).attr('href'); 73 if ($(target).length > 0) { 74 $('html, body').stop().animate({ 75 'scrollTop': $(target).offset().top + 1 76 }, 900, 'swing', function () { 77 $(document).on("scroll", onScroll); 78 }); 79 } 80}); 81 82/** Add Class on scroll */ 83// function onScroll(event){ 84// var scrollPos = $(document).scrollTop(); 85// $('.wpfm-menu-wrapper a[href^="#"]').each(function () { 86// var currLink = $(this); 87// var refElement = $(currLink.attr("href")); 88// if(refElement != '#' && $(refElement).length > 0){ 89// if(refElement.position().top){ 90// if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos){ 91// $('.wpfm-menu-wrapper ul li a').removeClass("wpfm-active-nav"); 92// currLink.addClass("wpfm-active-nav"); 93// } 94// else{ 95// currLink.removeClass("wpfm-active-nav"); 96// } 97// } 98// } 99// }); 100// } 101 102function onScroll(event) { 103 var scrollPos = $(document).scrollTop(); 104 $('.wpfm-menu-wrapper a[href^="#"]').each(function () { 105 var currLink = $(this); 106 var refElement = $(currLink.attr("href")); 107 var positon_offset_var = $(this).data("pos-offset-var"); 108 if (positon_offset_var == '1') { 109 if (refElement != '#' && $(refElement).length > 0) { 110 if (refElement.offset().top) { 111 if (refElement.offset().top <= scrollPos && refElement.offset().top + refElement.height() > scrollPos) { 112 $('.wpfm-menu-wrapper ul li').removeClass("wpfm-active-nav"); 113 currLink.parent("li").addClass("wpfm-active-nav"); 114 } else { 115 currLink.parent("li").removeClass("wpfm-active-nav"); 116 } 117 } 118 } 119 } else { 120 if (refElement != '#' && $(refElement).length > 0) { 121 if (refElement.position().top) { 122 if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) { 123 $('.wpfm-menu-wrapper ul li').removeClass("wpfm-active-nav"); 124 currLink.parent("li").addClass("wpfm-active-nav"); 125 } else { 126 currLink.parent("li").removeClass("wpfm-active-nav"); 127 } 128 } 129 } 130 } 131 132 });
133} 134}); /** Function ends */ 135}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.