Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(document).ready(function($) {
  2.  
  3.     //Disable default link behavior for dummy links that have href='#'
  4.     // ---------------------------------------------------------------
  5.     var $emptyLink = $("a[href='#']");
  6.     $emptyLink.on('click', function(e){
  7.         e.preventDefault();
  8.     });
  9.  
  10.     // Initialize Slidebars
  11.     // var menuInitHeight
  12.     var controller = new slidebars();
  13.     controller.init();
  14.  
  15.     $( '.offcanvas-toggle' ).on( 'click', function ( event ) {
  16.  
  17.         // Set initial menu height value
  18.         menuInitHeight = $( '.offcanvas-navigation .menu' ).height()
  19.         // Stop default action and bubbling
  20.         event.stopPropagation();
  21.         event.preventDefault();
  22.  
  23.         // Toggle the Slidebar with id 'id-1'
  24.         controller.toggle( 'id-1' );
  25.     } );
  26.  
  27.     // Offcanvas Navigation
  28.     // --------------------
  29.  
  30.     // Back Button
  31.     // -----------
  32.     var menuInitHeight,
  33.         backBtnText = $( '.offcanvas-navigation' ).data( 'back-btn-text' ),
  34.         subMenu = $( '.offcanvas-navigation .sub-menu' );
  35.  
  36.  
  37.     $('.offcanvas-toggle').on('click', function() {
  38.         menuInitHeight = $( '.offcanvas-navigation .menu' ).height()
  39.     });
  40.     subMenu.each( function () {
  41.         $( this ).prepend( '<li class="back-btn"><a href="#">' + backBtnText + '</a></li>' );
  42.     } );
  43.  
  44.     var hasChildLink = $( '.menu-item-has-children > a' ),
  45.         backBtn = $( '.offcanvas-navigation .sub-menu .back-btn' );
  46.  
  47.     backBtn.on( 'click', function ( e ) {
  48.         var self = this,
  49.             parent = $( self ).parent(),
  50.             siblingParent = $( self ).parent().parent().siblings().parent(),
  51.             menu = $( self ).parents( '.menu' );
  52.  
  53.         parent.removeClass( 'in-view' );
  54.         siblingParent.removeClass( 'off-view' );
  55.         if ( siblingParent.attr( "class" ) === "menu" ) {
  56.  
  57.             menu.velocity( { height: menuInitHeight }, 100 );
  58.         } else {
  59.             menu.velocity( { height: siblingParent.height() }, 100 );
  60.         }
  61.  
  62.         e.stopPropagation();
  63.     } );
  64.  
  65.     hasChildLink.on( 'click', function ( e ) {
  66.         var self = this,
  67.             parent = $( self ).parent().parent(),
  68.             menu = $( self ).parents( '.menu' );
  69.  
  70.         parent.addClass( 'off-view' );
  71.         $( self ).parent().find( '> .sub-menu' ).addClass( 'in-view' );
  72.         menu.velocity( { height: $( self ).parent().find( '> .sub-menu' ).height() }, 100 );
  73.  
  74.         e.preventDefault();
  75.         return false;
  76.     } );
  77.  
  78.     // Coundown init
  79.     // -------------
  80.     if($('.countdown').length > 0) {
  81.         $(".countdown")
  82.             .countdown("2017/08/08", function(event) {
  83.                 var $this = $(this).html(event.strftime(''
  84.                     + '<span>Deal ends in</span>'
  85.                     + '<div> <span>%D</span> days</div>'
  86.                     + '<div> <span>%H</span> hr</div>'
  87.                     + '<div> <span>%M</span> min</div>'
  88.                     + '<div> <span>%S</span> sec</div>'));
  89.             });
  90.     }
  91.  
  92.     // Range Slider
  93.     // ------------
  94.     if($('.slider-margin').length > 0) {
  95.         var marginSlider = document.getElementById('slider-margin');
  96.         noUiSlider.create(marginSlider, {
  97.             start: [ 120, 800 ],
  98.             margin: 1,
  99.             step: 1,
  100.             connect: true,
  101.             range: {
  102.                 'min': 0,
  103.                 'max': 1000
  104.             },
  105.             format: wNumb({
  106.                 decimals: 0,
  107.                 thousand: '.',
  108.                 prefix: '$',
  109.             })
  110.         });
  111.     }
  112.  
  113.     // Extend to range slider digits
  114.     // -----------------------------
  115.     if($('.slider-margin').length > 0) {
  116.         var marginMin = document.getElementById('slider-margin-value-min'),
  117.             marginMax = document.getElementById('slider-margin-value-max');
  118.  
  119.         marginSlider.noUiSlider.on('update', function ( values, handle ) {
  120.             if ( handle ) {
  121.                 marginMax.innerHTML = values[handle];
  122.             } else {
  123.                 marginMin.innerHTML = values[handle];
  124.             }
  125.         });
  126.     }
  127.  
  128.     // Gallery popUp
  129.     // -------------
  130.     if($('.zoom-gallery').length > 0) {
  131.         $('.zoom-gallery').magnificPopup({
  132.             delegate: '.gallery-item',
  133.             type: 'image',
  134.             closeOnContentClick: false,
  135.             closeBtnInside: false,
  136.             mainClass: 'mfp-with-zoom mfp-img-mobile',
  137.             image: {
  138.                 verticalFit: true,
  139.                 titleSrc: function(item) {
  140.                     return item.el.attr('title') + ' &middot; <a class="image-source-link" href="'+item.el.attr('data-source')+'" target="_blank">image source</a>';
  141.                 }
  142.             },
  143.             gallery: {
  144.                 enabled: true
  145.             },
  146.             zoom: {
  147.                 enabled: true,
  148.                 duration: 300, // don't foget to change the duration also in CSS
  149.                 opener: function(element) {
  150.                     return element.find('img');
  151.                 }
  152.             }
  153.  
  154.         });
  155.     }
  156.  
  157.     // All Scripts For On Load Init
  158.     // ----------------------------
  159.     $(window).on('load', function() {
  160.         // Tiles Carousel
  161.         // (Settings are Customized Thru Data Attr)
  162.         // ----------------------------------------
  163.         if($('.preview-carousel').length > 0) {
  164.             $('.preview-carousel').slick({
  165.                 slidesToShow: 1,
  166.                 slidesToScroll: 1,
  167.                 draggable: false,
  168.                 customPaging : function(slider, i) {
  169.                     var color = $(slider.$slides[i]).data('color');
  170.                     return '<a style="background-color: '+color+'"></a>';
  171.                 },
  172.                 nextArrow:
  173.                     '<i class="slick-next material-icons chevron_right"></i>',
  174.                 prevArrow:
  175.                     '<i class="slick-prev material-icons chevron_left"></i>'
  176.             });
  177.         }
  178.  
  179.         // Tiles Carousel
  180.         // (Settings are Customized Thru Data Attr)
  181.         // ----------------------------------------
  182.         if($('.deal-carousel').length > 0) {
  183.             $('.deal-carousel').slick({
  184.                 slidesToShow: 1,
  185.                 slidesToScroll: 1,
  186.                 draggable: true,
  187.                 appendArrows: $('.arrows'),
  188.                 nextArrow:
  189.                     '<i class="slick-next material-icons chevron_right"></i>',
  190.                 prevArrow:
  191.                     '<i class="slick-prev material-icons chevron_left"></i>'
  192.             });
  193.         }
  194.  
  195.         // Image Carousel
  196.         // (Settings are Customized Thru Data Attr)
  197.         // ----------------------------------------
  198.         if($('.image-carousel').length > 0) {
  199.             $('.image-carousel').slick({
  200.                 slidesToShow: 1,
  201.                 slidesToScroll: 1,
  202.                 draggable: true,
  203.                 customPaging : function(slider, i) {
  204.                     var color = $(slider.$slides[i]).data('color');
  205.                     return '<a style="background-color: '+color+'"></a>';
  206.                 },
  207.                 nextArrow:
  208.                     '<i class="slick-next material-icons chevron_right"></i>',
  209.                 prevArrow:
  210.                     '<i class="slick-prev material-icons chevron_left"></i>'
  211.             });
  212.         }
  213.  
  214.         // Category Carousel
  215.         // -----------------
  216.         $('.items-carousel').slick({
  217.             slidesToShow: 5,
  218.             slidesToScroll: 1,
  219.             nextArrow:
  220.                 '<i class="slick-next material-icons chevron_right"></i>',
  221.             prevArrow:
  222.                 '<i class="slick-prev material-icons chevron_left"></i>',
  223.             responsive: [
  224.                 {
  225.                     breakpoint: 1024,
  226.                     settings: {
  227.                         slidesToShow: 4
  228.                     }
  229.                 },
  230.                 {
  231.                     breakpoint: 600,
  232.                     settings: {
  233.                         slidesToShow: 2
  234.                     }
  235.                 },
  236.                 {
  237.                     breakpoint: 480,
  238.                     settings: {
  239.                         slidesToShow: 1
  240.                     }
  241.                 }
  242.             ]
  243.         });
  244.  
  245.         // Isotope Grid
  246.         // ------------
  247.         var $grid = $('.masonry-grid');
  248.         if($grid.length > 0) {
  249.             $grid.isotope({
  250.                 itemSelector: '.grid-item',
  251.                 transitionDuration: '0.7s',
  252.                 masonry: {
  253.                     columnWidth: '.grid-sizer',
  254.                     gutter: '.gutter-sizer'
  255.                 }
  256.             });
  257.         }
  258.  
  259.         // Filtering Isotope Grid
  260.         // ----------------------
  261.         if($('.filter-grid').length > 0) {
  262.             var $filterGrid = $('.filter-grid');
  263.             $('.nav-filters').on( 'click', 'a', function(e) {
  264.                 e.preventDefault();
  265.                 $('.nav-filters li').removeClass('active');
  266.                 $(this).parent().addClass('active');
  267.                 var $filterValue = $(this).attr('data-filter');
  268.                 $filterGrid.isotope({ filter: $filterValue });
  269.             });
  270.         }
  271.  
  272.         // Revolution SLider Init & Settings
  273.         // ---------------------------------
  274.         jQuery("#slider1").revolution({
  275.             sliderType:"standart",
  276.             sliderLayout:"fullscreen",
  277.             dottedOverlay:"none",
  278.             disableProgressBar:"on",
  279.             delay:7000,
  280.             navigation: {
  281.                 arrows:{
  282.                     enable:true,
  283.                     hide_onleave:true
  284.                 },
  285.                 touch:{
  286.                     touchenabled:"on",
  287.                     swipe_treshold : 75,
  288.                     swipe_min_touches : 1,
  289.                     drag_block_vertical:false,
  290.                     swipe_direction:"horizontal"
  291.                 }
  292.             },
  293.             fullScreenOffsetContainer: ".header",
  294.             responsiveLevels:[2000,992,768,400],
  295.             visibilityLevels:[2020,1024,778,480],
  296.             gridwidth:[2000,1200,750,480],
  297.             gridheight:[768,768,500,720],
  298.             parallax: {
  299.                 type:"mouse",
  300.                 origo:"slidercenter",
  301.                 speed:2500,
  302.                 levels:[5,10,20,30,25,30,35,40,45,50,47,48,49,50,51,55],
  303.                 ddd_shadow:"off",
  304.                 ddd_bgfreeze:"on",
  305.                 ddd_overflow:"hidden",
  306.                 ddd_layer_overflow:"visible",
  307.                 ddd_z_correction:1705,
  308.             }
  309.         });
  310.  
  311.         // Single Item Page Carousel
  312.         // -------------------------
  313.         $('.thumbnail-carousel').slick({
  314.             slidesToShow: 5,
  315.             centerMode: true,
  316.             centerPadding: '0',
  317.             asNavFor: '.image-preview1',
  318.             focusOnSelect: true,
  319.             infinite: false
  320.         });
  321.  
  322.         $('.image-preview1').slick({
  323.             slidesToShow: 1,
  324.             slidesToScroll: 1,
  325.             infinite: false,
  326.             asNavFor: '.thumbnail-carousel'
  327.         });
  328.  
  329.         // Google Maps API
  330.         // ---------------
  331.         var $googleMap = $('.google-map');
  332.         if($googleMap.length > 0) {
  333.             $googleMap.each(function(){
  334.                 var mapHeight = $(this).data('height'),
  335.                     address = $(this).data('address'),
  336.                     zoom = $(this).data('zoom'),
  337.                     controls = $(this).data('disable-controls'),
  338.                     scrollwheel = $(this).data('scrollwheel'),
  339.                     marker = $(this).data('marker'),
  340.                     markerTitle = $(this).data('marker-title'),
  341.                     styles = $(this).data('styles');
  342.                 $(this).height(mapHeight);
  343.                 $(this).gmap3({
  344.                     marker:{
  345.                         address: address,
  346.                         data: markerTitle,
  347.                         options: {
  348.                             icon: marker
  349.                         },
  350.                         events: {
  351.                             mouseover: function(marker, event, context){
  352.                                 var map = $(this).gmap3("get"),
  353.                                     infowindow = $(this).gmap3({get:{name:"infowindow"}});
  354.                                 if (infowindow){
  355.                                     infowindow.open(map, marker);
  356.                                     infowindow.setContent(context.data);
  357.                                 } else {
  358.                                     $(this).gmap3({
  359.                                         infowindow:{
  360.                                             anchor:marker,
  361.                                             options:{content: context.data}
  362.                                         }
  363.                                     });
  364.                                 }
  365.                             },
  366.                             mouseout: function(){
  367.                                 var infowindow = $(this).gmap3({get:{name:"infowindow"}});
  368.                                 if (infowindow){
  369.                                     infowindow.close();
  370.                                 }
  371.                             }
  372.                         }
  373.                     },
  374.                     map:{
  375.                         options:{
  376.                             zoom: zoom,
  377.                             disableDefaultUI: controls,
  378.                             scrollwheel: scrollwheel,
  379.                             styles: styles
  380.                         }
  381.                     }
  382.                 });
  383.             });
  384.         }
  385.  
  386.     });
  387.  
  388. });/* Document Ready End */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement