balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

main.js (2098B)


      1 ;(function ($) {
      2     "use strict";
      3 
      4 
      5     jQuery(document).ready(function($) {
      6     /*----------------------------------
      7        magnific popup activation
      8    ----------------------------------*/
      9         $('.image-popup').magnificPopup({
     10             type: 'image'
     11         });
     12         $('.video-play-btn').magnificPopup({
     13             type: 'video'
     14         });
     15 
     16         /*-------------------------------
     17             back to top
     18         ------------------------------*/
     19         $(document).on('click', '.back-to-top', function () {
     20             $("html,body").animate({
     21                 scrollTop: 0
     22             }, 2000);
     23         });
     24 
     25         /*-------------------------------
     26           Navbar Fix
     27         ------------------------------*/
     28         if($(window).width() < 991){
     29             navbarFix()
     30         }
     31 
     32     });
     33 
     34     $(window).on('resize', function () {
     35         /*-------------------------------
     36             Navbar Fix
     37         ------------------------------*/
     38         if($(window).width() < 991){
     39             navbarFix()
     40         }
     41     });
     42 
     43 
     44     //define variable for store last scrolltop
     45     var lastScrollTop = '';
     46     $(window).on('scroll', function () {
     47         /*---------------------------
     48             back to top show / hide
     49         ---------------------------*/
     50         var ScrollTop = $('.back-to-top');
     51         if ($(window).scrollTop() > 1000) {
     52             ScrollTop.fadeIn(1000);
     53         } else {
     54             ScrollTop.fadeOut(1000);
     55         }
     56 
     57 
     58     });
     59 
     60     $(window).on('load',function(){
     61         /*-----------------------------
     62             preloader
     63         -----------------------------*/
     64         var preLoder = $("#preloader");
     65         preLoder.fadeOut(1000);
     66         /*-----------------------------
     67             back to top
     68         -----------------------------*/
     69         var backtoTop = $('.back-to-top')
     70         backtoTop.fadeOut(100);
     71     });
     72 
     73     function navbarFix(){
     74         $(document).on('click','.navbar-area .navbar-nav li.menu-item-has-children>a, .navbar-area .navbar-nav li.appside-megamenu>a',function(e){
     75             e.preventDefault();
     76         })
     77     }
     78 
     79 
     80 
     81 })(jQuery);