$(document).ready(function () { $(".burger_menu,.menu_bg").on("click", function () { $(".burger_menu").toggleClass("active"); $(".responsive_menu").toggleClass("active"); $(".menu_bg").toggleClass("active"); $("body").toggleClass("burgermenu"); }); // header user menu click $(".header_user_div").on("click", function (e) { e.stopPropagation(); if ($(".user_menu_toggler").hasClass("active")) { $(".user_menu_toggler").removeClass("active"); $(".user_menu").slideUp().removeClass("active"); } else { $(".user_menu_toggler").addClass("active"); $(".user_menu").slideDown().addClass("active"); } }); $(document).on("mouseup", function (e) { if ($(e.target).parents(".header_user_div").length == 0) { $(".user_menu").slideUp().removeClass("active"); $(".user_menu_toggler").removeClass("active"); } }); $(".footer_links_li_header").on("click", function () { $(this).parent(".footer_links").toggleClass("active"); }); $(".favourite_toggler").on("click", function () { $(this).toggleClass("active"); }); var timeout_var; $(window).resize(function () { rearrange_header_menus(); }); rearrange_header_menus(); function rearrange_header_menus() { var w_wit = $(window).width(); if (w_wit < 1200) { $(".header_top_menu").appendTo(".responsive_menu"); } else { $(".header_top_menu").appendTo(".header_top"); $(".burger_menu").removeClass("active"); $(".responsive_menu").removeClass("active"); $(".menu_bg").removeClass("active"); } if (w_wit <1200) { $(".header_burger_menu").appendTo(".responsive_menu"); $(".header_menu").appendTo(".responsive_menu"); } else { $(".header_burger_menu").appendTo(".header_bottom"); $(".header_menu").appendTo(".header_bottom"); } if (w_wit < 899) { $(".header_link").appendTo(".responsive_menu"); } else { $(".header_link").appendTo(".header_top"); } if (w_wit < 992) { $("#screens").appendTo("#screens_div"); $("#screens_cover").removeAttr("style"); } else { $("#screens").appendTo("#screens_cover"); } if (w_wit < 576) { $(".price_details").appendTo("#rate_cover .show_price"); } else { $(".price_details").prependTo(".right_bar"); } } //replace result title replace_result_title(); var timeout_title; $(window).resize(function () { replace_result_title(); }); function replace_result_title() { var w_wid = $(window).width(); if (w_wid < 900) { if ($("#title_div > #result_title").length == 0) { $("#result_title").appendTo("#title_div"); } } else { if ($("#right_section").find("#result_title").length == 0) { $("#result_title").appendTo("#right_section"); } } } $(".more_tags").on("click", function (e) { e.preventDefault(); if ($(this).parents(".singleline_tags").hasClass("show_all")) { // $(this).find("i").addClass("bi-plus-circle").removeClass("bi-dash-circle"); $(this).parents(".singleline_tags").removeClass("show_all"); } else { // $(this).find("i").addClass("bi-dash-circle").removeClass("bi-plus-circle"); $(this).parents(".singleline_tags").addClass("show_all"); } }); replace_search(); var timeout_search; $(window).resize(function () { replace_search(); }); function replace_search() { var w_wid = $(window).width(); var h_heit=120; if (w_wid < 640) { if ($(".header_bottom").find(".header_search").length == 0) { $(".header_search").appendTo(".header_bottom"); if ($(".home_search").length == 0) { $(".header_top").removeClass("showsearch"); $(".header_bottom").addClass("showsearch"); } } else { if ($(".home_search").length == 0) { $(".header_top").removeClass("showsearch"); $(".header_bottom").addClass("showsearch"); } } // header_margin /* if($(".m_header").hasClass(".has_offer")) { $(".m_main").css("margin-top", h_heit-$(".offer_note").outerHeight()); }*/ setTimeout(function(){ h_heit = $(".m_header").outerHeight(true); $(".m_main").css("margin-top", h_heit); },300); } else { if ($(".header_top").find(".header_search").length == 0) { $(".header_search").appendTo(".header_top"); if ($(".home_search").length == 0) { $(".header_bottom").removeClass("showsearch"); $(".header_top").addClass("showsearch"); } } else { if ($(".home_search").length == 0) { $(".header_bottom").removeClass("showsearch"); $(".header_top").addClass("showsearch"); } } // header_margin /*********************************************/ // h_heit = $(".m_header").outerHeight(); //$(".m_main").css("margin-top", h_heit); setTimeout(function(){ h_heit = $(".m_header").outerHeight(true); $(".m_main").css("margin-top", h_heit); },300); } } var prev_scrol = 0; var prev_scrol_header = 0; var scroll_buffer = 10; $(window).scroll(function () { var check_top = 0; var check_headertop = 0; var cur_pos = $(this).scrollTop(); // for header // hide check if ($(".home_page").length !== 0) { check_headertop = $(".m_header").outerHeight(true); if ($(window).scrollTop() > check_headertop + (1*check_headertop)) { //if ($(window).scrollTop() >($(window).height()/2)) { //disable $(".m_header").addClass("show_header"); if (cur_pos > prev_scrol_header) //scrolling down { //console.log("scrolling down"); //disable $(".m_header").removeClass("show_header"); //set_sidebar_menu_height(); } else if (cur_pos < prev_scrol_header) { //scrolling up //console.log("scrolling up >>>>"); //disable $(".m_header").addClass("show_header"); } } else if ($(window).scrollTop() == 0) // else { //disable $(".m_header").removeClass("show_header"); //$(".m_header").removeClass("hide_header").addClass("show_header"); // $(".m_header").removeClass("hide_header").removeClass("show_header").addClass("make_view"); } prev_scrol_header = cur_pos; // hide} // for header if ($(window).width() > 639) { if ($(".home_search").length !== 0) { check_top = ($(".home_search").position().top + $(".home_search").outerHeight() + ($(".m_header").outerHeight() / 2)); if ($(window).scrollTop() > check_top) { if ($(".header_top").hasClass("showsearch")) { } else { $(".header_top").addClass("showsearch"); } } else { $(".header_top").removeClass("showsearch"); } } } else { //mobile <640 //if (Math.abs(prev_scrol - cur_pos) >= scroll_buffer) { if ($(".home_search").length !== 0) { check_top = $(".home_search").position().top + $(".home_search").outerHeight() + ($(".m_header").outerHeight() / 2); //} if ($(window).scrollTop() > check_top) { //console.log("greter"); if (cur_pos > prev_scrol) { //scrolling down //console.log("scroll down home"); var prnt = $(".header_search").parent(); $(prnt).removeClass("showsearch"); } else if (cur_pos < prev_scrol) { // scrolling up //console.log("scroll up home"); var prnt = $(".header_search").parent(); if ($(prnt).hasClass("showsearch")) { //console.log("alredy"); } else { //console.log("adddinggg"); $(prnt).addClass("showsearch"); cur_pos = $(window).scrollTop(); } } } else { //console.log("scroll down"); var prnt = $(".header_search").parent(); $(prnt).removeClass("showsearch"); } } else { //mobile inner page //console.log("mob sclirn"); check_top = $(".m_header").outerHeight(); //console.log("scroll down else", cur_pos, ":::", prev_scrol, "ck top:", check_top); if ($(window).scrollTop() > check_top) { if (cur_pos > prev_scrol) { //scrolling down $(".header_bottom").removeClass("showsearch"); } else if (cur_pos < prev_scrol) { // scrolling up //console.log("scroll up else"); if ($(".header_bottom").hasClass("showsearch")) { //console.log("alredy"); } else { //console.log("adddinggg"); $(".header_bottom").addClass("showsearch"); cur_pos = $(window).scrollTop(); } } } } //} prev_scrol = cur_pos; //console.log("cur pos:", cur_pos, "pev po:", prev_scrol, "mins:", prev_scrol - scroll_buffer); //else } }); // set minimum height for pages /**********************************************************/ function onElementHeightChange(elm, callback){ var lastHeight = elm.clientHeight, newHeight; //var lastScrollY = window.pageYOffset, newScrollY; (function run(){ newHeight = elm.clientHeight; if( lastHeight != newHeight ) callback(); lastHeight = newHeight; if (elm.onElementHeightChangeTimer) clearTimeout(elm.onElementHeightChangeTimer); elm.onElementHeightChangeTimer = setTimeout(run, 50); })(); } var reach_bottom = 0, prev_dir=0, firstcheck=0; onElementHeightChange(document.body, function(){ //alert('Body height changed'); //console.log('Body height has changed:', document.body.style.height, ' - current scroll', window.pageYOffset); set_main_height(); //set_sidebar_menu_height(); }); /**********************************************************/ set_main_height(); function set_main_height() { var min_hei=0; // sidebar is present if($(".leftbar_cover ").length!=0) { if($(".leftbar").length!=0) { if($(".breadcrumb_cover").length!=0) { //min_hei= $(".leftbar").outerHeight()+$(".breadcrumb_cover").outerHeight(); } else{ //min_hei= $(".leftbar").outerHeight(); } } else if($(".account_menu").length!=0) { if($(".breadcrumb_cover").length!=0) { //min_hei= $(".account_menu_ul").outerHeight()+$(".breadcrumb_cover").outerHeight(); } else{ //min_hei= $(".account_menu_ul").outerHeight(); } } else{ //min_hei = $(window).height() - $(".m_header").outerHeight(); } } else{ } // alert(min_hei); if ($(window).width() > 899) { min_hei = $(window).height() - $(".m_header").outerHeight(); $(".m_main").css("min-height",min_hei); if($(".page_wrap").length>0) { $(".page_wrap").css("min-height",min_hei); } if ($(".account_page").length> 0) { check_account_menu(); } else if ($(".leftbar_cover").length > 0) { check_sidebar_menu(); } } else { if($(".page_wrap").length!=0) { $(".page_wrap").removeAttr("style"); } if ($(".account_page").length > 0) { clear_account_menu(); } if ($(".leftbar_cover").length > 0) { clear_sidebar_menu(); } } if($(window).width()>991) { if($(".rightbar_cover").length!=0) { // $(".rightbar_wrap").css("min-height",$(".rightbar").outerHeight()); //check_rightbar_cover(); check_rightbar_reverse(); } } else{ if($(".rightbar_cover").length!=0) { //clear_rightbar_cover(); clear_rightbar_reverse(); } } }//func // submit button public side $("#signup_btn").on("click", function (e) { e.preventDefault(); if ($(this).parents("form").hasClass("form_error")) { var totop = $(".form_error:first-child").position().top; $("html, body").animate({ scrollTop: totop - 90 }, 500); msg_popup("error", "Please fill in all Fields Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut sed quae cum iste commodi, minus consequuntur iusto tempore qui doloribus voluptates veniam veritatis, vero laudantium culpa autem vel possimus incidunt! !!", ""); } else { msg_popup("success", "Submitted Succesfully", ""); } }); //msg popup var poptimer; function msg_popup(msg_type, msg_title, msg_note) { clearTimeout(poptimer); $(".msg_popup").attr("class", "msg_popup"); if (msg_type == "success") { $(".msg_popup").addClass("success").removeClass("error"); $(".msg_icon i").addClass("bi-check2").removeClass("bi-exclamation"); } else if (msg_type == "error") { $(".msg_popup").addClass("error").removeClass("success"); $(".msg_icon i").addClass("bi-exclamation").removeClass("bi-check2"); } $(".msg_popup").find(".msg_title").html(msg_title); $(".msg_popup").find(".msg_note").html(msg_note); $(".msg_popup").addClass("show_msg"); //fade out animation poptimer = setTimeout(function () { $(".msg_popup").attr("class", "msg_popup") }, 3000); } //leftbar section $(".leftbar_section_title").on("click", function () { $(this).parent().toggleClass("open"); }); // height adjust category cover > category list adjust_catgy_item(); var timeout_categy; $(window).resize(function () { clearTimeout(timeout_categy); timeout_categy = setTimeout(function () { adjust_catgy_item(); }, 150); }); function adjust_catgy_item() { if ($(window).width() > 439) { var old_hei = 0; $(".home_category_item").each(function () { $(this).removeAttr("style"); if ($(this).outerHeight() > old_hei) { old_hei = $(this).outerHeight(); } }).promise().done(function () { $(".home_category_item").each(function () { $(this).css("height", old_hei); }); }); } else { $(".home_category_item").each(function () { $(this).removeAttr("style"); }); } } //Popup functions $("#signin_btn").on("click", function () { $("#reminder").fadeIn().addClass("show_popup"); }); $("body").on("click", ".popup_close", function () { $(this).parents().find(".popup").fadeOut().removeClass("show_popup"); }); $("body").on("click", ".popup_cancel_btn", function () { $(this).parents().find(".popup").fadeOut().removeClass("show_popup"); }); $("body").on("click", ".popup_bg", function (e) { e.preventDefault(); $(this).parents().find(".popup").fadeOut().removeClass("show_popup"); }); /*****************************************************/ set_sidebar_menu_height(); var timeout_accmenu; $(window).resize(function () { clearTimeout(timeout_accmenu); timeout_accmenu = setTimeout(function () { set_sidebar_menu_height(); }, 50); }); function set_sidebar_menu_height() { if ($(window).width() > 899) { if ($(".account_page").length > 0) { check_account_menu(); } else if ($(".leftbar_cover").length > 0) { check_sidebar_menu(); } } else { clear_sidebar_menu(); clear_account_menu(); } if($(window).width()>991) { if($(".rightbar").length!=0) { // check_rightbar_cover(); check_rightbar_reverse(); } } else{ if($(".rightbar").length!=0) { //clear_rightbar_cover(); clear_rightbar_reverse(); } } } /**************************************/ $(window).scroll(function () { if ($(window).width() > 899) { if ($(".account_page").length > 0) { check_account_menu(); } else if ($(".leftbar_cover").length > 0) { check_sidebar_menu(); } } if ($(window).width() > 991) { if ($(".rightbar").length > 0) { //check_rightbar_cover(); check_rightbar_reverse(); } } else if ($(".page_wrap").length > 0) { // clear_rightbar_cover(); clear_rightbar_reverse(); } }); /************************************************/ function check_sidebar_menu() { var side_menu =$(".leftbar"); var menu_offtop = $(side_menu).offset().top; var menu_ptop = $(side_menu).position().top; var pag = $(".leftbar_cover"); var scroll_top = $(window).scrollTop(); var menu_bottom = $(side_menu).outerHeight(); var pag_bottom = $(pag).offset().top+$(pag).outerHeight(true); var ftop=0; // optional condition if($(pag).find(".breadcrumb_cover").length!=0) { ftop=$(".breadcrumb_cover").outerHeight(true); } if($(pag).offset().top+ftop< scroll_top && (scroll_top + menu_bottom) < pag_bottom) { //top $(side_menu).css({"position":"fixed","top":"0", "bottom":"auto"}); } else if( scroll_top + menu_bottom > pag_bottom) { //page bottom $(side_menu).css({"position":"absolute","top":"auto", "bottom":"0"}); } else { $(side_menu).css({"position":"relative","top":"0" }); } } function clear_sidebar_menu() { $(".leftbar_mobile_title").appendTo($(".top_btns")); var menu = $(".leftbar"); /*$(menu).removeClass("fixed_cover").removeClass("absolute_cover").css({ top: "0" }); */ $(menu).removeClass("fixed_cover").removeClass("absolute_cover").removeAttr("style"); } $(".leftbar_mobile_title").on("click", function () { $(".leftbar_cover").addClass("show_filter"); $("body").addClass("burgermenu"); }); $(".filter_close_btn, .leftbar_bg").on("click", function () { $("body").removeClass("burgermenu"); $(".leftbar_cover").removeClass("show_filter"); }); // show / hide category Lists mega menu // in width> 1199 var mdelay=700, timer_menu, menu_li; $(".header_menu").on("mouseenter" , function(){ clearTimeout(timer_menu); menu_li= $(this); if($(window).width()>1199) { timer_menu=setTimeout(function(){ $(menu_li).addClass("on_menu"); }, mdelay); } }).on("mouseleave", function() { if($(window).width()>1199){ timer_menu=setTimeout(function(){ $(menu_li).removeClass("on_menu"); $(".header_menu_name").removeClass("active"); clearTimeout(timer_menu); },mdelay*2); } }); $(window).resize(function(){ if($(window).width()>1199){ $(menu_li).removeClass("on_menu"); $(".header_menu_name").removeClass("active"); clearTimeout(timer_menu); } }); $(".header_menu_li").on("mouseenter" , function(){ if($(window).width()>1199) { $(".header_menu_name").each(function(){ $(this).removeClass("active"); }); $(this).find(".header_menu_name").addClass("active"); } }); $(".header_menu_name").on("click", function(){ if($(window).width()>1199) { clearTimeout(timer_menu); $(".header_menu").addClass("on_menu"); $(".header_menu_name").removeClass("active"); } //var menuli=$(this).parent(".header_menu_li"); if($(this).hasClass("active")) { $(this).removeClass("active"); } else{ $(this).addClass("active"); // $(this).addClass("active"); } }); // account menu $(".account_menubar").on("click", function () { $(".leftbar_cover").addClass("show_menu"); $("body").addClass("burgermenu"); }); $(".account_menu_bg").on("click", function () { $("body").removeClass("burgermenu"); $(".leftbar_cover").removeClass("show_menu"); }); // check account menu function check_account_menu() { var acc_menu =$(".account_menu"); var menu_offtop = $(acc_menu).offset().top; var menu_ptop = $(acc_menu).position().top; var pag = $(".leftbar_cover"); var scroll_top = $(window).scrollTop(); var menu_bottom = $(acc_menu).outerHeight(); var pag_bottom = $(pag).offset().top+$(pag).outerHeight(true); if($(pag).offset().top< scroll_top && (scroll_top + menu_bottom) < pag_bottom) { //top $(acc_menu).css({"position":"fixed","top":"0", "bottom":"auto"}); } else if( scroll_top + menu_bottom > pag_bottom) { //page bottom $(acc_menu).css({"position":"absolute","top":"auto", "bottom":"0"}); } else { $(acc_menu).css({"position":"absolute","top":"0" }); } } function clear_account_menu() { var menu = $(".account_menu"); $(menu).removeClass("fixed_cover").removeClass("absolute_cover").removeAttr("style"); } function check_rightbar_cover() { var rightbar_menu =$(".rightbar"); var menu_offtop = $(rightbar_menu).offset().top; var menu_ptop = $(rightbar_menu).position().top; var pag = $(".rightbar_cover"); //$(".rightbar_ref").css("padding","0"); $(pag).css("width",$(".rightbar_ref").width() -(2* parseInt($(pag).css("padding-left")))); var menu_width= $(pag).width(); var scroll_top = $(window).scrollTop(); var menu_bottom = $(rightbar_menu).outerHeight(); var pag_bottom = $(pag).offset().top+$(pag).outerHeight(); if($(".rightbar_wrap").outerHeight() <=menu_bottom) { // condition false; $(rightbar_menu).removeAttr("style"); }else{ //condition true if($(pag).offset().top< scroll_top && (scroll_top + menu_bottom) < pag_bottom) { //top $(rightbar_menu).css({"position":"fixed","top":"0", "bottom":"auto", "width":menu_width}); } else if( scroll_top + menu_bottom > pag_bottom) { //page bottom $(rightbar_menu).css({"position":"absolute","top":"auto", "bottom":"0", "width":menu_width}); } else { $(rightbar_menu).css({"position":"absolute","top":"0", "width":menu_width}); } } } function clear_rightbar_cover() { var menu = $(".rightbar"); $(menu).removeAttr("style"); $(".rightbar_cover").removeAttr("style"); $(".rightbar_ref").removeAttr("style"); } //var reach_bottom = 0, prev_dir=0, firstcheck=0; function check_rightbar_reverse() { var rightbar_menu =$(".rightbar"); var right_menu_offtop = $(rightbar_menu).offset().top; // var menu_ptop = $(rightbar_menu).position().top; // var menu_hei = $(rightbar_menu).outerHeight(true); var right_pag = $(".rightbar_cover"); var pag_offtop = $(".rightbar_cover").offset().top; var pag_hei = $(".rightbar_cover").outerHeight(true); var pag_ptop = $(".rightbar_cover").position().top; //$(".rightbar_ref").css("padding","0"); $(right_pag).css("width",$(".rightbar_ref").width() -(2.1* parseInt($(right_pag).css("padding-left")))); var menu_width= $(right_pag).width(); var wind_hei= $(window).height(); var cur_dir = $(this).scrollTop(); var scroll_top = $(window).scrollTop(); var rmenu_bottom = $(rightbar_menu).outerHeight(true) + $(rightbar_menu).offset().top; var rpag_bottom = $(right_pag).offset().top+$(right_pag).outerHeight(true); if(firstcheck==0) { //if menu_cover bottom visible in page if(rpag_bottom-scroll_top "+$(rightbar_menu).outerHeight(true)+"<>"+wind_hei+"<>"+(rpag_bottom-scroll_top)); //if() reach_bottom=1; //page bottom $(rightbar_menu).addClass("inside_two").removeClass("inside_three").removeClass("inside_four").removeClass("inside_one"); $(rightbar_menu).css({"position":"absolute","top":"auto", "bottom":"0", "width":menu_width}); } else{ // alert($(pag).outerHeight(true)+"<>"+$(rightbar_menu).outerHeight(true)+"<>"+wind_hei+"<>"+(rpag_bottom-scroll_top)); // if not bottom but fixed bottom - ie if menucover scrolltop greater than menu height } firstcheck=1; } { if(rmenu_bottom -scroll_top< wind_hei && (right_menu_offtop + pag_offtop) !=0 && reach_bottom==0 && cur_dir>prev_dir ) { //top $(rightbar_menu).addClass("inside_one").removeClass("inside_three").removeClass("inside_two").removeClass("inside_four"); $(rightbar_menu).css({"position":"fixed","top":"auto", "bottom":"0", "width":menu_width}); } /*else*/ if(rmenu_bottom-scroll_top > rpag_bottom-scroll_top && cur_dir>prev_dir ) { reach_bottom=1; //page bottom $(rightbar_menu).addClass("inside_two").removeClass("inside_three").removeClass("inside_four").removeClass("inside_one"); $(rightbar_menu).css({"position":"absolute","top":"auto", "bottom":"0", "width":menu_width}); } /*new*/ if(rmenu_bottom-scroll_top > rpag_bottom-scroll_top &&reach_bottom==1 && cur_dir>prev_dir) { //page bottom $(rightbar_menu).addClass("inside_two").removeClass("inside_three").removeClass("inside_four").removeClass("inside_one"); $(rightbar_menu).css({"position":"absolute","top":"auto", "bottom":"0", "width":menu_width}); } /*else*/ if( rpag_bottom-scroll_top >wind_hei && reach_bottom==1 && cur_dir575){ $(this).parent(".script_list_image").css("max-height","50%"); } else{ $(this).parent(".script_list_image").removeAttr("style"); } });*/ $(".script_list_box .script_list_image img").each(function () { var mhei = $(this).parents().find(".script_list_box").outerHeight(true); if ($(window).width() > 767) { $(this).parents().find(".script_list_image").css("max-height", Math.ceil(mhei * .99)); } else { $(this).parents().find(".script_list_image").removeAttr("style"); } }); } // auto modal on page load $("#infomodal").modal({ backdrop: "static", focus: true }); $('#infomodal').on('show.bs.modal', function (event) { var thiss = $(this); thiss.find(".modal-title").text(""); thiss.find(".modal-body").html(''); thiss.find(".modal-body").addClass("text-center"); thiss.find(".modal-footer").hide(); }); // $("#infomodal").modal("show"); $("#offer_modal").on("show.bs.modal", function (e) { var thiss = $(this); thiss.find(".modal-footer").hide(); }); setTimeout(function () { // $('#offer_modal').modal("show"); }, 5000); limit_details_length(); function limit_details_length() { $(".script_list_card .script_list_descp").each(function () { var txt = $(this).text(); if (txt.length > 120) { $(this).text(txt.substring(0, 120) + '...'); } }); } }); /*document ready*/