(function ($){
$(function (){
if($(".wpfm-nav-strech-trigger")[0]&&($(".wpfm-nav-strech-trigger").attr('id')=='right'
|| $(".wpfm-nav-strech-trigger").attr('id')=='left')){
$('.wpfm-nav-strech-trigger').click(function (e){
e.preventDefault();
$('.wpfm-nav-strech-trigger').hide();
$('ul.wpfm-nav-show-hide').slideToggle(400);
});
}
if($(".wpfm-nav-close-trigger")[0]&&($(".wpfm-nav-close-trigger").attr('id')=='right'
|| $(".wpfm-nav-close-trigger").attr('id')=='left')){
$('.wpfm-nav-close-trigger').click(function (e){
e.preventDefault();
$('.wpfm-nav-strech-trigger').show();
$('ul.wpfm-nav-show-hide').slideUp(400);
});
}
$(".wpfm-menu-name").hover(function (){
$(this).find('.wpfm-tootltip-title').css('opacity', '1');
});
if($('body').find('.wpfm-menu-wrapper').attr('data-disable-double-touch')!=='1'){
var clickBtn=true;
if("ontouchstart" in document.documentElement){
document.documentElement.className +=" wpfm-touch";
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^="#"]');
$(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){
container.not(this).removeClass('wpfm_hover_effect');
$(this).toggleClass('wpfm_hover_effect')
if($(this).hasClass('wpfm_hover_effect')){
e.preventDefault();
}else{
}});
$(document).mouseup(function (e){
if(!container.is(e.target)
&& container.has(e.target).length===0){
container.removeClass('wpfm_hover_effect');
}});
}}
if($('.wpfm-floating-wh-wrapper a[href^="#"]').length > 0){
$(document).on("scroll", onScroll);
}
$('.wpfm-floating-wh-wrapper a[href^="#"]').on('click', function (e){
e.preventDefault();
var target=$(this).attr('href');
if($(target).length > 0){
$('html, body').stop().animate({
'scrollTop': $(target).offset().top + 1
}, 900, 'swing', function (){
$(document).on("scroll", onScroll);
});
}});
function onScroll(event){
var scrollPos=$(document).scrollTop();
$('.wpfm-menu-wrapper a[href^="#"]').each(function (){
var currLink=$(this);
var refElement=$(currLink.attr("href"));
var positon_offset_var=$(this).data("pos-offset-var");
if(positon_offset_var=='1'){
if(refElement!='#'&&$(refElement).length > 0){
if(refElement.offset().top){
if(refElement.offset().top <=scrollPos&&refElement.offset().top + refElement.height() > scrollPos){
$('.wpfm-menu-wrapper ul li').removeClass("wpfm-active-nav");
currLink.parent("li").addClass("wpfm-active-nav");
}else{
currLink.parent("li").removeClass("wpfm-active-nav");
}}
}}else{
if(refElement!='#'&&$(refElement).length > 0){
if(refElement.position().top){
if(refElement.position().top <=scrollPos&&refElement.position().top + refElement.height() > scrollPos){
$('.wpfm-menu-wrapper ul li').removeClass("wpfm-active-nav");
currLink.parent("li").addClass("wpfm-active-nav");
}else{
currLink.parent("li").removeClass("wpfm-active-nav");
}}
}}
});
}});
}(jQuery));