Guest User

Untitled

a guest
Jul 22nd, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. $(document).ready(function() {
  3.  
  4.     // NAVIGATION
  5.     jQuery('.main-menu li a,.footer-menu li a').each(function(){ var title = jQuery(this).attr('title'); jQuery(this).parent().addClass(title); }); jQuery('ul li a[title="contact"]').click(function(e){ e.preventDefault(); var scrollP = jQuery('#bottom').offset(); jQuery('html,body').animate({scrollTop: scrollP.top}, 1000); }); // FOOTER jQuery('.beers-section .beers-wrapper').filter(':first-child').addClass('some-beers').next().addClass('some-bottles-and-cans');
  6.  
  7.  
  8.     // Slider
  9.    
  10.     $('.slider-wrapper ul li:first-child').addClass('current-slide');
  11.    
  12.     $('.slider-controls a.prev').click(function(e) {
  13.         e.preventDefault();
  14.         if(!$('.slider-wrapper ul').is(':animated')) {
  15.             if(!$('li.current-slide').is(':first-child')) {
  16.                 var margin = $('li.current-slide').prev().width()+24;
  17.                 $('.slider-wrapper ul').animate({'marginLeft': "+="+margin}, 1000);
  18.                 $('li.current-slide').prev().addClass('current-slide');
  19.                 $('li.current-slide').last().removeClass('current-slide');
  20.             } else {
  21.                 $(this).unbind('mouseenter');
  22.             };
  23.         };
  24.     })
  25.    
  26.     $('.slider-controls a.next').click(function(e) {
  27.         e.preventDefault();
  28.         if(!$('.slider-wrapper ul').is(':animated')) {
  29.             if(!$('li.current-slide').is(':last-child')) {
  30.                 var margin = $('li.current-slide').width()+24;
  31.                 $('.slider-wrapper ul').animate({'marginLeft': "-="+margin}, 1000);
  32.                 $('li.current-slide').next().addClass('current-slide');
  33.                 $('li.current-slide').first().removeClass('current-slide');
  34.             };
  35.         };
  36.     })
  37.    
  38.     // Menu
  39.    
  40.     $(".the-menu-item a").hover(
  41.       function () {
  42.         $(this).find('span.download-link').show();
  43.       },
  44.       function () {
  45.         $(this).find('span.download-link').hide();
  46.       }
  47.     );
  48.    
  49.     // Animations
  50.  
  51.             if(!getCookie('visited')) {
  52.                 $(window).load(function() {
  53.                     var sidebarHeight = $('.sidebar').outerHeight();
  54.                     $('.sidebar').css({
  55.                         'top': -(sidebarHeight+90)
  56.                     })
  57.                     $('.sidebar').animate({'top': 0}, 2000, function(){
  58.                         $('.sidebar h1, .sidebar h2').fadeIn(1000)
  59.                         $('.header .social-section').animate({'top': 0}, 1000);
  60.                         $('.main-menu').animate({'left': 0}, 1000);
  61.                     })
  62.                     setCookie('visited', 1, 7);
  63.                 });
  64.             } else {
  65.                 $('body').addClass('visited')
  66.             }
  67.            
  68.             $(window).bind('unload', function() {
  69.                 eraseCookie('visited');
  70.             });
  71.  
  72.  
  73.  
  74.        
  75.    
  76.     // Cookies
  77.    
  78.     function setCookie(name, value, days) {
  79.        var now=new Date();
  80.        var expTime=now.getTime()+days*24*60*60*1000;
  81.        var expDate=new Date(expTime);
  82.        document.cookie=name+"="+value+"; EXPIRES="+expDate.toGMTString();
  83.     }
  84.    
  85.     function getCookie(name) {
  86.        var start=document.cookie.indexOf(name+"=");
  87.        if(start==-1) return null;
  88.        var len=start+name.length+1;
  89.        var end=document.cookie.indexOf(";", len);
  90.        if(end==-1) end=document.cookie.length;
  91.        return document.cookie.substring(len, end)
  92.        return true
  93.     }
  94.    
  95.     function eraseCookie(name) {
  96.         setCookie(name,"",-1);
  97.     }
  98.  
  99.    
  100.     // Contact Menu Item
  101.    
  102.     $('.main-menu li.contact a').click(function(e){
  103.         e.preventDefault();
  104.         $("html").animate({ scrollTop: $(document).height() }, "slow");
  105.  
  106.     })
  107.  
  108. });
Add Comment
Please, Sign In to add comment