(function($) { 'use strict'; $('#simple-menu').sidr(); $('#sidr button').click(function(event) { $.sidr('close', 'sidr'); }); $(window).load(function() { $('.preloader-section').fadeOut('slow', function() { $(this).remove(); }); }); // Sticky Header on Scroll var menu = $('#top-header'); var origOffsetY = menu.offset().top; function scroll () { if ($(window).scrollTop() >= origOffsetY) { menu.addClass('sticky'); } else { menu.removeClass('sticky'); } } document.onscroll = scroll; // ScrollTop Button $('.go-top').click(function(){ $("html, body").animate({ scrollTop: 0 }, 600); return false; }); /*----------------------------------------------------*/ /* MOBILE AND TABLET DETECT FUNCTION /*----------------------------------------------------*/ var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; function parallaxInit() { var testMobile = isMobile.any(); if (testMobile == null) { $(".parallax-twitter").parallax("50%", 0.3); $('.waypoint-element').waypoint(function() { $(this).addClass('fadeInUp animated'); }, { offset: '90%', triggerOnce: true }); } } $(window).bind("load", function() { parallaxInit() }); })(jQuery);