PageSourceSearch

https://kingstontechnical.com/wp-content/themes/karma/js/custom-main.js

js kingstontechnical.com collected 2026-10-07 03:48:44 UTC 26,882 bytes, 629 lines download raw bytes

1/*-------------------------------------------------------------- 
2Fire up functions on $(document).ready()
3--------------------------------------------------------------*/
4jQuery(document).ready(function () {
5	truethemes_SuperFish();
6	truethemes_MobileMenu();
7	jQuery("#menu-main-nav li:has(ul)").addClass("parent");
8	jQuery(".ubermenu-nav li:has(ul)").addClass("tt-uber-parent");
9	truethemes_Sliders();
10	jQuery('.slider-content-video,.video_wrapper').fitVids();
11	truethemes_Gallery();
12    truethemes_masonry_blog();
13	jQuery('div.mc_signup_submit input#mc_signup_submit').removeClass('button');
14    jQuery('.checkout-button.button.alt.wc-forward').find('br').remove();
15
16    /* accessibility - outline links / keyboard tabbing
17    truethemes_KeyboardTab();
18    */
19
20    //parallax
21    jQuery('.tt-parallax-text').fadeIn(1000); //delete this to remove fading content
22
23    var $window = jQuery(window);
24    jQuery('section[data-type="background"]').each(function () {
25        var $bgobj = jQuery(this);
26
27        jQuery(window).scroll(function () {
28            var yPos = -($window.scrollTop() / $bgobj.data('speed'));
29            var coords = '50% ' + yPos + 'px';
30            $bgobj.css({
31                backgroundPosition: coords
32            });
33        });
34    });
35});
36/*-------------------------------------------------------------- 
37Fire up functions on $(window).load()
38--------------------------------------------------------------*/
39jQuery(window).load(function () {
40	truethemes_Fadeimages();
41	truethemes_MobileSubs();
42	truethemes_LightboxHover();
43	jQuery("a[data-gal^='prettyPhoto']").prettyPhoto({
44        hook:'data-gal', // do not change, sky will fall
45        theme: 'light_square', // options: light_rounded / dark_rounded / pp_default / dark_square / facebook 
46    });
47	truethemes_ScrollTop();
48	truethemes_Tabs();
49	if (jQuery(window).width() > 1024) { //only load sticky on non-mobile devices
50		truethemes_StickySidebar();
51	}
52	truethemes_flexslider_for_gallery_post_format();
53});
54/*---------------------------------------------------------------------------*/
55/*
56/* Note to developers:
57/* Easily uncompress any functions using: http://jsbeautifier.org/
58/*
59/*---------------------------------------------------------------------------*/
60/*-------------------------------------------------------------- 
61Superfish - Dropdown Menus
62--------------------------------------------------------------*/
63function truethemes_SuperFish(){
64//only activate top-toolbar if child <ul> is present
65jQuery(".top-block ul:has(ul)").addClass("sf-menu");
66jQuery('ul.sf-menu').superfish({
67    delay: 100,
68    animation: {
69        opacity: 'show',
70        height: 'show'
71    },
72    speed: 'fast',
73    disableHI: true,
74    autoArrows: false,
75    dropShadows: false
76})
77}
78// 2/3/4th level menu  offscreen fix
79// thanks to sakib000: https://forum.jquery.com/topic/suprtfish-menu-text-off-screen       
80var wapoMainWindowWidth = jQuery(window).width();
81jQuery('#menu-main-nav.sf-menu ul li').mouseover(function(){  
82    // checks if third level menu exist        
83    var subMenuExist = jQuery(this).find('.sub-menu').length;           
84    if( subMenuExist > 0){
85        var subMenuWidth = jQuery(this).find('.sub-menu').width();
86        var subMenuOffset = jQuery(this).find('.sub-menu').parent().offset().left + subMenuWidth;
87
88        // if sub menu is off screen, give new position
89        if((subMenuOffset + subMenuWidth) > wapoMainWindowWidth){                 
90            var newSubMenuPosition = subMenuWidth + 14;
91            jQuery(this).find('.sub-menu').css({
92                left: -newSubMenuPosition
93            });
94        }
95    }
96 });
97/*-------------------------------------------------------------- 
98Sliders + Testimonials
99--------------------------------------------------------------*/
100function truethemes_Sliders(){
101//data pulled in from Site Options using wp_localize()
102var tt_slider_directionNav;
103var tt_slider_pause_hover;
104var tt_slider_randomize;
105var tt_testimonial_directionNav;
106var tt_testimonial_pause_hover;
107var tt_testimonial_randomize;
108if(php_data.karma_jquery_directionNav == 'true'){tt_slider_directionNav = true;}else{tt_slider_directionNav = false;}
109if(php_data.karma_jquery_pause_hover  == 'true'){tt_slider_pause_hover  = true;}else{tt_slider_pause_hover  = false;}
110if(php_data.karma_jquery_randomize    == 'true'){tt_slider_randomize    = true;}else{tt_slider_randomize    = false;}
111if(php_data.testimonial_directionNav  == 'true'){tt_testimonial_directionNav = true;}else{tt_testimonial_directionNav = false;}
112if(php_data.testimonial_pause_hover   == 'true'){tt_testimonial_pause_hover  = true;}else{tt_testimonial_pause_hover  = false;}
113if(php_data.testimonial_randomize     == 'true'){tt_testimonial_randomize    = true;}else{tt_testimonial_randomize    = false;}
114//karma jquery sliders
115jQuery('.jquery1-slider-wrap, .jquery2-slider-bg, .jquery3-slider-wrap').flexslider({
116	slideshowSpeed: php_data.karma_jquery_slideshowSpeed,
117	pauseOnHover:   tt_slider_pause_hover,
118	randomize:      tt_slider_randomize,
119	directionNav:   tt_slider_directionNav,
120	animation:      php_data.karma_jquery_animation_effect,
121	animationSpeed: php_data.karma_jquery_animationSpeed,
122	smoothHeight: true
123});
124//testimonial shortcode
125jQuery('.testimonials').flexslider({
126	slideshowSpeed: php_data.testimonial_slideshowSpeed,
127	pauseOnHover:   tt_testimonial_pause_hover,
128	randomize:      tt_testimonial_randomize,
129	directionNav:   tt_testimonial_directionNav,
130	animation:      php_data.testimonial_animation_effect,
131	animationSpeed: php_data.testimonial_animationSpeed,
132	controlsContainer: ".testimonials",
133	smoothHeight: true
134});
135
136jQuery('.true-testimonial-1-flexslider').flexslider({
137    slideshowSpeed: php_data.testimonial_slideshowSpeed,
138    animation: "slide",
139    namespace: "true-",
140    start: function(slider) {
141        slider.removeClass('loading');
142    }
143});
144
145jQuery('.true-testimonial-2-flexslider').flexslider({
146    slideshowSpeed: php_data.testimonial_slideshowSpeed,
147    animation: "slide",
148    controlNav: "thumbnails",
149    namespace: "true-",
150    start: function(slider) {
151        slider.removeClass('loading');
152    }
153});
154
155}
156/*-------------------------------------------------------------- 
157Tabs
158--------------------------------------------------------------*/
159function truethemes_Tabs(){
160//Added since 3.0.2 dev 4. 
161//tabs init code, added with browser url sniff to get tab id to allow activating tab via link
162//example url http://localhost:8888/karma-experimental/shortcodes/tabs-accordion/?tab=2
163var tab_id = window.location.search.split('?tab=');
164if (tab_id) {
165    var tab_index = tab_id[1] - 1;
166    jQuery('.tabs-area').tabs({
167        show: { effect: "fadeIn" },
168        hide: { effect: "fadeOut" },
169        active: tab_index
170    })
171} else {
172    jQuery('.tabs-area').tabs({
173        show: { effect: "fadeIn" },
174        hide: { effect: "fadeOut" },
175        active: 0
176    })
177}
178}
179/*-------------------------------------------------------------- 
180Keyboard Tabbing (for accessibility)
181--------------------------------------------------------------*/
182function truethemes_KeyboardTab() {
183jQuery(function(){
184    var lastKey = new Date(),
185        lastClick = new Date();
186    jQuery(document).on( "focusin", function(e){
187        jQuery(".non-keyboard-outline").removeClass("non-keyboard-outline");
188        var wasByKeyboard = lastClick < lastKey
189        if( wasByKeyboard ) {
190            jQuery( e.target ).addClass( "non-keyboard-outline");
191        }     
192    }); 
193    jQuery(document).on( "click", function(){
194        lastClick = new Date();
195    });
196    jQuery(document).on( "keydown", function() {
197        lastKey = new Date();
198    });
199});
200}
201/*-------------------------------------------------------------- 
202Image Fade-in
203--------------------------------------------------------------*/
204function truethemes_Fadeimages() {
205    jQuery('[class^="attachment"]').each(function (index) {
206        var t = jQuery('[class^="attachment"]').length;
207        // When retina.js swaps the images, the new image, being
208        // larger, overflows the frame. To fix this, take the
209        // size of the zoomlayer, and apply it to the new image.
210        // We do it regardless of whether the image has been swapped
211        // by retina.js since it would be a waste to detect whether
212        // the iamge has been swapped.
213        var z = jQuery(this).prev('.lightbox-zoom');
214        jQuery(this).css({
215            'width': z.css('width'),
216            'height': z.css('height')
217        });
218        if (t > 0) {
219            jQuery(this).delay(160 * index).fadeIn(400)
220        }
221    })
222}
223/*-------------------------------------------------------------- 
224Lightbox hover
225--------------------------------------------------------------*/
226function truethemes_LightboxHover() {
227    jQuery('.lightbox-img').hover(function() {
228        jQuery(this).children().first().children().first().stop(true);
229        jQuery(this).children().first().children().first().fadeTo('normal', .90)
230    }, function() {
231        jQuery(this).children().first().children().first().stop(true);
232        jQuery(this).children().first().children().first().fadeTo('normal', 0)
233    })
234}
235/*-------------------------------------------------------------- 
236Scroll to Top
237--------------------------------------------------------------*/
238function truethemes_ScrollTop() {
239    jQuery('a.link-top').click(function() {
240        if (!jQuery.browser.opera) {
241            jQuery('body').animate({
242                scrollTop: 0
243            }, {
244                queue: false,
245                duration: 1200
246            })
247        }
248        jQuery('html').animate({
249            scrollTop: 0
250        }, {
251            queue: false,
252            duration: 1200
253        });
254        return false
255    })
256}
257jQuery(document).ready(function($){
258    // browser window scroll (in pixels) after which the "back to top" link is shown
vendor: 4,467 bytes, lines 259-303
259    var offset = 300,
260        //duration of the top scrolling animation
261        scroll_top_duration = 700,
262        //grab the "back to top" link
263        $back_to_top = $('.karma-scroll-top');
264    //hide or show the "back to top" link
265    $(window).scroll(function(){
266        ( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out');
267    });
268    //smooth scroll to top
269    $back_to_top.on('click', function(event){
270        event.preventDefault();
271        $('body,html').animate({
272            scrollTop: 0 ,
273            }, scroll_top_duration
274        );
275    });
276
277});
278/*-------------------------------------------------------------- 
279Sticky Sidebar
280--------------------------------------------------------------*/
281function truethemes_StickySidebar() {
282
283    /* var tt_sticky_menu_one;
284    var tt_sticky_menu_two;
285
286    if(php_data.sticky_menu_one == 'true'){tt_sticky_menu_one = true;}else{tt_sticky_menu_one = false;}
287    if(php_data.sticky_menu_two == 'true'){tt_sticky_menu_two = true;}else{tt_sticky_menu_two = false;} */
288
289// Since 4.4 - site option to activate sticky
290if(php_data.sticky_sidebar == 'true'){
291
292/*
293 Sticky-kit v1.1.3 | MIT | Leaf Corcoran 2015 | http://leafo.net
294*/
295(function(){var c,f;c=window.jQuery;f=c(window);c.fn.stick_in_parent=function(b){var A,w,J,n,B,K,p,q,L,k,E,t;null==b&&(b={});t=b.sticky_class;B=b.inner_scrolling;E=b.recalc_every;k=b.parent;q=b.offset_top;p=b.spacer;w=b.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=c(document);null==w&&(w=!0);L=function(a){var b;return window.getComputedStyle?(a=window.getComputedStyle(a[0]),b=parseFloat(a.getPropertyValue("width"))+parseFloat(a.getPropertyValue("margin-left"))+
296parseFloat(a.getPropertyValue("margin-right")),"border-box"!==a.getPropertyValue("box-sizing")&&(b+=parseFloat(a.getPropertyValue("border-left-width"))+parseFloat(a.getPropertyValue("border-right-width"))+parseFloat(a.getPropertyValue("padding-left"))+parseFloat(a.getPropertyValue("padding-right"))),b):a.outerWidth(!0)};J=function(a,b,n,C,F,u,r,G){var v,H,m,D,I,d,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k));if(!g.length)throw"failed to find stick parent";
297v=m=!1;(h=null!=p?p&&a.closest(p):c("<div />"))&&h.css("position",a.css("position"));x=function(){var d,f,e;if(!G&&(I=A.height(),d=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),b=parseInt(g.css("padding-bottom"),10),n=g.offset().top+d+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q,u=a.outerHeight(!0),r=a.css("float"),h&&h.css({width:L(a),
298height:u,display:a.css("display"),"vertical-align":a.css("vertical-align"),"float":r}),e))return l()};x();if(u!==C)return D=void 0,d=q,z=E,l=function(){var c,l,e,k;if(!G&&(e=!1,null!=z&&(--z,0>=z&&(z=E,x(),e=!0)),e||A.height()===I||x(),e=f.scrollTop(),null!=D&&(l=e-D),D=e,m?(w&&(k=e+u+d>C+n,v&&!k&&(v=!1,a.css({position:"fixed",bottom:"",top:d}).trigger("sticky_kit:unbottom"))),e<F&&(m=!1,d=q,null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.detach()),c={position:"",width:"",top:""},a.css(c).removeClass(t).trigger("sticky_kit:unstick")),
299B&&(c=f.height(),u+q>c&&!v&&(d-=l,d=Math.max(c-u,d),d=Math.min(q,d),m&&a.css({top:d+"px"})))):e>F&&(m=!0,c={position:"fixed",top:d},c.width="border-box"===a.css("box-sizing")?a.outerWidth()+"px":a.width()+"px",a.css(c).addClass(t),null==p&&(a.after(h),"left"!==r&&"right"!==r||h.append(a)),a.trigger("sticky_kit:stick")),m&&w&&(null==k&&(k=e+u+d>C+n),!v&&k)))return v=!0,"static"===g.css("position")&&g.css({position:"relative"}),a.css({position:"absolute",bottom:b,top:"auto"}).trigger("sticky_kit:bottom")},
300y=function(){x();return l()},H=function(){G=!0;f.off("touchmove",l);f.off("scroll",l);f.off("resize",y);c(document.body).off("sticky_kit:recalc",y);a.off("sticky_kit:detach",H);a.removeData("sticky_kit");a.css({position:"",bottom:"",top:"",width:""});g.position("position","");if(m)return null==p&&("left"!==r&&"right"!==r||a.insertAfter(h),h.remove()),a.removeClass(t)},f.on("touchmove",l),f.on("scroll",l),f.on("resize",y),c(document.body).on("sticky_kit:recalc",y),a.on("sticky_kit:detach",H),setTimeout(l,
3010)}};n=0;for(K=this.length;n<K;n++)b=this[n],J(c(b));return this}}).call(this);
302
303//make em' stick
304if(php_data.sticky_menu_one == 'true' || php_data.sticky_menu_two == 'true'){
305
306    //sticky header is active so we increase the offset :)
307    jQuery("#sidebar").stick_in_parent({ offset_top: 100 }); //sidebar
308    jQuery("#sub_nav").stick_in_parent({ offset_top: 100 }); //sub navigation
309
310    } else {
311
312    //jQuery("#sidebar").stick_in_parent({ offset_top: 15, spacer: false }); //sidebar - use this version for (iframe) widgets in left sidebar
313    jQuery("#sidebar").stick_in_parent({ offset_top: 15 }); //sidebar
314    jQuery("#sub_nav").stick_in_parent({ offset_top: 10 }); //sub navigation
315
316    } // END_IF - sticky-header-check
317
318} // END_IF - (php_data.sticky_sidebar)
319} // END truethemes_StickySidebar()
320/*-------------------------------------------------------------- 
321Mobile Menu
322--------------------------------------------------------------*/
323function truethemes_MobileMenu() {
324//@since 4.0.2  check for ubermenu mobile-menu settings and adjust code accordingly
325//php_data pulled in from Site Options using wp_localize()
326/*
327 * @since 4.8.6 mobile menu no longer compatible with uberMenu
328 *
329if(php_data.ubermenu_active == 'true'){
330    var mobileMenuClone = jQuery(".ubermenu-nav").clone().attr("id", "tt-mobile-menu-list");
331} else {
332    var mobileMenuClone = jQuery("#menu-main-nav").clone().attr("id", "tt-mobile-menu-list");
333}*/
334var mobileMenuClone = jQuery("#menu-main-nav").clone().attr("id", "tt-mobile-menu-list");
335function truethemes_MobileMenu(){var windowWidth=jQuery(window).width();if(windowWidth<=767)if(!jQuery("#tt-mobile-menu-button").length){jQuery('<a id="tt-mobile-menu-button" href="#tt-mobile-menu-list"><span>'+php_data.mobile_menu_text+"</span></a>").prependTo("#header");mobileMenuClone.insertAfter("#tt-mobile-menu-button").wrap('<div id="tt-mobile-menu-wrap" />');tt_menu_listener()}else jQuery("#tt-mobile-menu-button").css("display",
336"block");else{jQuery("#tt-mobile-menu-button").css("display","none");mobileMenuClone.css("display","none")}}truethemes_MobileMenu();function tt_menu_listener(){jQuery("#tt-mobile-menu-button").click(function(e){if(jQuery("body").hasClass("ie8")){var mobileMenu=jQuery("#tt-mobile-menu-list");if(mobileMenu.css("display")==="block")mobileMenu.css({"display":"none"});else{var mobileMenu=jQuery("#tt-mobile-menu-list");mobileMenu.css({"display":"block","height":"auto","z-index":999,"position":"absolute"})}}else jQuery("#tt-mobile-menu-list").stop().slideToggle(500);
337e.preventDefault()});jQuery("#tt-mobile-menu-list").find("> .menu-item").each(function(){var $this=jQuery(this),opener=$this.find("> a"),slide=$this.find("> .sub-menu")})}jQuery(window).resize(function(){truethemes_MobileMenu()});jQuery(window).load(function(){jQuery("#tt-mobile-menu-list").hide()});jQuery(document).ready(function(){jQuery("#tt-mobile-menu-list").hide()})
338
339// Buzu adds this Aug 1st 2015
340// Function modified to serve the mega menu as well. Nov 1st 2015 (Buzu)
341if (jQuery('body').hasClass('karma-no-mobile-submenu')) {
342    // get all mobile menu items with sub menus
343    var subs,
344        sub_parents,
345        mega_menus = mobileMenuClone.find('.karma_mega_div'),
346        target;
347
348    // before doing anything, check if we have a mega menu, if so strip the mega
349    // menu stuff out
350    if (mega_menus.length) {
351        mega_menus.each(function () {
352            var $this = jQuery(this);
353                sub = $this.children('.sub-menu'),
354                paren = $this.parent('li');
355
356                paren.append(sub);
357                $this.remove();
358        });
359    }
360
361    subs = mobileMenuClone.find('li > ul'),
362    sub_parents = subs.parent('li');
363
364    subs.hide();
365
366    mobileMenuClone.find('.karma_mega_div').css('display', 'block');
367
368    sub_parents.append('<i class="fa fa-chevron-down"></i>');
369    mobileMenuClone.on('click', '.fa-chevron-down', function () {
370        var $this = jQuery(this);
371
372        // small optimization.
373        // save the target on the trigger to avoid searching for it everytime
374        // user clicks to show/hide sub-menu
375        if (!$this.data('target')) {
376            target = $this.parent().children('.sub-menu');
377
378            $this.data('target', target);
379        }
380
381        $this.data('target').slideToggle();
382        $this.toggleClass('sub-menu-trigger--open')
383    });
384} else {
385    // open the main nav submenues that have been hid by superfish
386    mobileMenuClone.find('.sub-menu').css('display', 'block');
387    mobileMenuClone.find('.karma_mega_div').css('display', 'block');
388}
389// Buzu ends here Aug 1st 2015
390};
391/*-------------------------------------------------------------- 
392Mobile Menu - Left/Right Nav
393--------------------------------------------------------------*/
394function truethemes_MobileSubs() {
395    // Buzu modified this function to make it work properly. Changes made can be
396    // identified by their comments starting with B: (May 27 2016)
397    //
398    // B: Save the new elements so that they can be used later.
399    var select = jQuery("<select />").appendTo("#sub_nav, body.karma-mobile-horz-dropdown #horizontal_nav");
400    jQuery("<option />", {
401        "selected": "selected",
402        "value": "",
403        "text": php_data.mobile_sub_menu_text
404    }).appendTo("#sub_nav select, body.karma-mobile-horz-dropdown #horizontal_nav select");
405    jQuery("#sub_nav a, body.karma-mobile-horz-dropdown #horizontal_nav a").each(function() {
406        var el = jQuery(this);
407        var new_el = jQuery("<option />", {
408            "value": el.attr("href"),
409            "text": el.text()
410        }).appendTo("#sub_nav select, body.karma-mobile-horz-dropdown #horizontal_nav select")
411
412        // B: If the original element has a filter data, add it to the clone too
413        if (el.data('filter')) {
414            new_el.data('filter', el.data('filter'));
415        }
416    });
417    jQuery("#sub_nav select, body.karma-mobile-horz-dropdown #horizontal_nav select").change(function() {
418        window.location = jQuery(this).find("option:selected").val()
419    })
420    // B: Do the actual sorting when the dropdown is changed, but only if the
421    // selected children has a filter data value
422    select.on('change', function (e) {
423        jQuery(this).children('option').each(function() {
424            if (this.selected && jQuery(this).data('filter')) {
425                jQuery('#tt-gallery-iso-wrap').isotope({
426                    filter: jQuery(this).data('filter')
427                });
428            }
429        });
430    });
431};
432/*-------------------------------------------------------------- 
433Gallery Filtering
434--------------------------------------------------------------*/
435function truethemes_Gallery() {
436    jQuery('#tt-gallery-iso-wrap').isotope({
437        animationOptions: {
438            duration: 750,
439            easing: 'linear',
440            queue: false
441        }
442    });
443    jQuery('#tt-gallery-iso-wrap').isotope({
444        layoutMode: 'fitRows'
445    });
446    jQuery('#tt-gallery-nav a').click(function () {
447        var selector = jQuery(this).attr('data-filter');
448        jQuery('#tt-gallery-iso-wrap').isotope({
449            filter: selector
450        });
451        return false
452    });
453    jQuery('#tt-gallery-nav li > a').click(function () {
454        jQuery('#tt-gallery-nav li').removeClass();
455        jQuery(this).parent().addClass('active')
456    })
457}
458/*-------------------------------------------------------------- 
459Masonry Blog
460--------------------------------------------------------------*/
461function truethemes_masonry_blog() {
462    // masonry blog
463jQuery('#tt-blog-container').isotope({
464  animationOptions: {
465   duration: 1150,
466   easing: 'linear',
467   queue: false
468   }
469});
470// also run isotope on resize for 'fluid appearance'
471jQuery(window).resize(function() {
472  jQuery('#tt-blog-container').isotope({
473    animationOptions: {
474     duration: 1150,
475     easing: 'linear',
476     queue: false
477     }
478  });
479});
480
481}
482/*-------------------------------------------------------------- 
483Flexslider for gallery post format
484--------------------------------------------------------------*/
485function truethemes_flexslider_for_gallery_post_format(){
486  jQuery('.karma-blog-slider').flexslider({
487  animation: "slide",
488  start: function(slider) {
489    slider.removeClass('loading');
490}
491});
492jQuery(".karma-blog-slider .flex-prev").addClass('fa fa-chevron-left').text('');
493jQuery(".karma-blog-slider .flex-next").addClass('fa fa-chevron-right').text('');
494}
495/*-------------------------------------------------------------- 
496Sticky Menu
497--------------------------------------------------------------*/
498function handleSWAppear() {
499    truethemes_undoStickyMenu();
500    jQuery('#menu-main-nav').one('scrollWatch.disappear', handleSWDisappear);
501}
502function handleSWDisappear() {
503    var subs = jQuery(this).find('.drop'),
504        open_sub = false;
505
506    subs.each(function () {
507        // Open submenus have opacity of 1
508        if (jQuery(this).css('opacity') > 0) {
509            open_sub = true;
510        }
511    });
512    // Do the sticky menu only if there is no open submenu. In small screens
513    // users may scroll down to see the entire submenu. If so, then a submenu
514    // will be open, but the menu may not be in the viewport anymore. We don't
515    // want to do the sticky menu in those cases.
516    if (!open_sub) {
517        truethemes_doStickyMenu();
518        jQuery('#menu-main-nav').one('scrollWatch.appear', handleSWAppear);
519    } else {
520        // register the handler again, in case the menu closes down. When the
521        // user scroll downs again, the menu will show up.
522        jQuery('#menu-main-nav').one('scrollWatch.disappear', handleSWDisappear);
523    }
524}
525
526function handleSWDisappear_2() {
527    var old_top;
528
529    function eventHandler_2() {
530        var new_top = jQuery(window).scrollTop();
531
532        if (old_top) {
533            if (new_top > old_top || new_top == 0) {
534                truethemes_undoStickyMenu();
535                jQuery(window).off('scroll', eventHandler_2);
536                jQuery(window).on('scroll', eventHandler);
537            }
538        }
539
540        old_top = new_top;
541    }
542
543    function eventHandler() {
544        var new_top = jQuery(window).scrollTop();
545
546        if (old_top) {
547            if (new_top < old_top) {
548                truethemes_doStickyMenu();
549                jQuery(window).off('scroll', eventHandler);
550                jQuery(window).on('scroll', eventHandler_2);
551            }
552        }
553
554        old_top = new_top;
555    }
556
557    jQuery(window).on('scroll', eventHandler);
558}
559
560function truethemes_StickyMenu(menu_type) {
561    if (menu_type == 1) {
562        jQuery('#menu-main-nav').one('scrollWatch.disappear', handleSWDisappear).scrollWatch();
563    } else if (menu_type == 2) {
564        jQuery('#menu-main-nav').one('scrollWatch.disappear', handleSWDisappear_2).scrollWatch();
565    }
566}
567
568function truethemes_doStickyMenu() {
569    var $ = jQuery;
570    var container = $('<div id="B_sticky_menu"></div>'),
571        tool_bar_clone = $('#header .top-block').clone(true);
572        header_clone = $('#header .header-holder').clone(true);
573
574    container.append(tool_bar_clone).append(header_clone);
575    container.css({
576        position: 'fixed',
577        left: 0,
578        top: -100,
579        width: '100%',
580        zIndex: 100,
581        opacity: 0,
582        boxShadow: '0 0 4px #000',
583    });
584    container.find('.header-area').css({
585        maxWidth: 980,
586        padding: '16px 0px',
587        margin: 'auto'
588    });
589    container.find('.logo').css({
590        'float': 'left',
591    });
592    /* container.find('.custom-logo').css({
593        'float': 'left',
594    }); */
595    container.find('.header-area').children().each(function() {
596        !($(this).hasClass('logo') || $(this).hasClass('custom-logo') || $(this).is('nav')) && $(this).remove();
597    });
598    $('body').append(container);
599    /*
600	* modification to original codes to prevent error when .top-aside which is top toolbar is deactivated.
601	* @since 4.0.5 dev 11 mod by denzel
602	*/
603    if(jQuery('.top-block').length == 0){    
604 		   container.animate({
605 		       top: $('#wpadminbar').length === 0 ? 0 : $('#header').offset().top,
606 		       opacity: 1
607 		   }, 700);
608	    }else{
609		    container.animate({
610		        top: $('#wpadminbar').length === 0 ? 0 : $('#header .top-block').offset().top,
611		        opacity: 1
612		    }, 700);       
613    }//endif
614}
615function truethemes_undoStickyMenu() {
616    jQuery('#B_sticky_menu').animate({
617        top: -300,
618        opacity: 0
619    }, {
620        duration: 400,
621        queue: false,
622        complete: function() {
623            jQuery(this).remove();
624            if (jQuery('#B_sticky_menu').length) {
625                truethemes_undoStickyMenu();
626            }
627        }
628    });
629}

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.