$(function() { "use strict"; // REMOVE # FROM URL $( 'a[href="#"]' ).click( function(e) { e.preventDefault(); }); // STICKY NAV var stickyHeaderTop = $("#slider").height(); //var stickyHeaderTop = $(window).height(); $(window).scroll(function() { if ($(window).scrollTop() > stickyHeaderTop) { $(".sticky-nav").css({position: "fixed", top: "0px"}); $(".sticky-nav").css("display", "block"); $(".sticky-nav").addClass("fixednav"); } else { $(".sticky-nav").css({position: "static", top: "0px"}); $(".sticky-nav").removeClass("fixednav"); } }); // ONE PAGE NAV $("#nav").onePageNav({ currentClass: 'current', changeHash: false, scrollSpeed: 750, scrollThreshold: 0.5, filter: '', easing: 'swing', begin: function() { //I get fired when the animation is starting }, end: function() { //I get fired when the animation is ending }, scrollChange: function($currentListItem) { //I get fired when you enter a section and I pass the list item of the section } }); // Portfolio FILTERS var $grid = $('#portfolio-grid'); $grid.shuffle({ itemSelector: '.portfolio-grid-item', // the selector for the items in the grid speed: 500 // Transition/animation speed (milliseconds) }); /* reshuffle when user clicks a filter item */ $('#portfolio-filter li a').click(function (e) { // set active class $('#portfolio-filter li a').removeClass('active'); $(this).addClass('active'); // get group name from clicked item var groupName = $(this).attr('data-group'); // reshuffle grid $grid.shuffle('shuffle', groupName ); }); //MAGNIFIC POPUP $('#portfolio-grid').magnificPopup({ delegate: 'a.zoom', type: 'image', gallery: { enabled: true } }); // Blog Carousel $("#blog-post-carousel").owlCarousel({ autoPlay: true, //Set AutoPlay to 3 seconds items : 3, stopOnHover : true, navigation : true, // Show next and prev buttons pagination : false, navigationText : ["",""], afterInit : function(elem){ var that = this that.owlControls.prependTo(elem) } }); // Testimonial Carousel $("#testimonial-carousel").owlCarousel({ autoPlay: true, //Set AutoPlay to 3 seconds items : 2, stopOnHover : true, navigation : false, // Show next and prev buttons pagination : true }); //AJAX CONTACT FORM $(".contact-form").submit(function() { var rd = this; var url = "sendemail.php"; // the script where you handle the form input. $.ajax({ type: "POST", url: url, data: $(".contact-form").serialize(), // serializes the form's elements. success: function(data) { //alert("Mail sent!"); // show response from the php script. $(rd).prev().text(data.message).fadeIn().delay(3000).fadeOut(); } }); return false; // avoid to execute the actual submit of the form. }); });