/* ***Custom JS*** //This Files Handles Custom Functions of this template */ $ = jQuery; function onScrollInit( items, trigger ) { items.each( function() { var osElement = $(this), osAnimationClass = osElement.attr('data-os-animation'), osAnimationDelay = osElement.attr('data-os-animation-delay'); var osTrigger = ( trigger ) ? trigger : osElement; osTrigger.waypoint(function() { osElement.addClass('animated').addClass(osAnimationClass); },{ triggerOnce: true, offset: '100%' }); }); } $(document).ready(function() { onScrollInit( $('.os-animation') ); /*Recent Post Slider---------------------*/ $(".recent_post_slider").owlCarousel({ items:3, autoPlay: 3000, pagination: true }); if(typeof countTo == 'function') { // Figures Count To // $('.timer').countTo(); } // Scrolling Here //Carousel Default// with 5 items at a time $(".carousel").owlCarousel(); // Single Item // $(".single_item_carousel").owlCarousel({ singleItem:true, autoPlay:3000, pagination:false }); /*---------------------------------*/ /* Modules Sliders /*---------------------------------*/ /*Top Slider-----------------------*/ $(".top_slider").owlCarousel({ singleItem: true, autoPlay: NT_CustomJS.homepage_topslider_interval, pagination: true, lazyLoad : true, afterInit: function() { jQuery("#text_slider").addClass("loaded"); } }); /*gereric--------------------------*/ $(".module_slider_single_item").owlCarousel({ singleItem:true, autoPlay: 3000, pagination: true, afterInit: function() { jQuery(".module_slider_wrapper").addClass("loaded"); jQuery(".module_slider").addClass("loaded"); } }); $(".module_slider_three_items").owlCarousel({ items: 3, autoPlay: 3000, pagination: true, afterInit: function() { jQuery(".module_slider_wrapper").addClass("loaded"); jQuery(".module_slider").addClass("loaded"); }, itemsDesktop: [1200,3] }); $(".module_slider_four_items").owlCarousel({ items: 4, autoPlay: 3000, pagination: true, afterInit: function() { jQuery(".module_slider_wrapper").addClass("loaded"); jQuery(".module_slider").addClass("loaded"); } }); /*Team-----------------------------*/ /* $(".team_slider").owlCarousel({ items: 3, autoPlay: 3000, pagination: true, }); */ /*Twitter--------------------------*/ /* $(".twitter_tweets").owlCarousel({ singleItem: true, autoPlay: 3000, pagination: true, });*/ /*Testimonial---------------------*/ /* $(".testimonials_slider").owlCarousel({ singleItem: true, autoPlay: NT_CustomJS.homepage_testimoial_interval, pagination: true, });*/ /*Services------------------------*/ /* $(".Services_Carousel").owlCarousel({ items: 3, autoPlay: NT_CustomJS.services_slider_time, pagination: true }); */ });// Ready /* Window LOAD */ $(window).load(function(){ //Delcear some Vars// // Get the height of nav wrapper var Nav_wrapper_height = $("#nav_wrapper").outerHeight(); if(NT_CustomJS.floatmenu==1){ // NAV bar offset var nav_bar_element = $('#nav_wrapper'); var nav_bar_offset = nav_bar_element.offset(); var nav_bar_offset_top = nav_bar_offset.top; // Changing Header on Scrolling // // Show Navigation if($( window ).scrollTop()>=nav_bar_offset_top) { nav_bar_element.addClass("fixed"); } else{ nav_bar_element.removeClass("fixed"); } // Scrolling Fixed Nav bar fix $(window).scroll(function() { // FOR HEADER MENU TO FIX ON SCROLL // if($( window ).scrollTop()>=nav_bar_offset_top) { nav_bar_element.addClass("fixed"); } else{ nav_bar_element.removeClass("fixed"); } }); }// floatmenu /* Scrolling Menues */ $('.page-scroll a, .page-scroll-button').bind('click', function(event) { var $anchor = $(this); // Fix issues of scrolling cauisng of fixed menue if($("#nav_wrapper").hasClass("fixed")){ var scrolltop = $($anchor.attr('href')).offset().top; } else{ var scrolltop =$($anchor.attr('href')).offset().top - Nav_wrapper_height ; } // fix issue causing of not adding sectio class if(!$anchor.hasClass(".section")) { var scrolltop = scrolltop - Nav_wrapper_height+1; } // Now lets animate it $('html, body').stop().animate({ scrollTop: scrolltop }, 1500, 'easeInOutExpo'); event.preventDefault(); // HERE WE ADD ACTIVE CLASS // lets remove first $(".page-scroll a").each(function(){ $(this).removeClass("active"); }) $anchor.addClass("active"); }); /*---------------------------------*/ /* AJAX Portfolio /*---------------------------------*/ // Close Button jQuery("body").on('click', '#close_portfolio', function(){ var $portfolio_details = jQuery("#portfolio_details"); $portfolio_details.slideUp('', function(){ $portfolio_details.removeClass('loading'); }); }) // AJAX // $(".grid_portfolio").click(function(){ // id of li var $id = jQuery(this).attr('id'); // reponse div var $portfolio_details = jQuery("#portfolio_details"); // post data var postdata = { 'action' : 'ajax_portfolio', 'id' : $id }; jQuery.ajax({ url: ajaxurl, type: 'POST', data: postdata, //dataType: 'json', beforeSend: function() { // clean up and add loading $portfolio_details.html('').fadeOut(0, function(){ $(this).addClass('loading').fadeIn('fast'); }); // scroll to element $('html, body').stop().animate({ scrollTop: $portfolio_details.offset().top-200 }, 1000, 'easeInOutExpo'); }, }).done(function(responseData) { //console.log(responseData); $portfolio_details.fadeOut('fast', function(){ $portfolio_details.removeClass('loading'); $portfolio_details.html(responseData).fadeIn('fast'); }); }); }); // Masonary and Filter if(typeof Freewall == 'function'){ var wall = new Freewall("#portfolio"); wall.reset({ selector: '.entry', animate: true, cellW: 5, cellH: 0, fixSize: 0, gutterX : 0, gutterY : 0, onResize: function() { wall.refresh(); } }); wall.filter(".entry"); $(".filter-label").click(function() { $(".filter-label").removeClass("is-checked"); var filter = $(this).addClass('is-checked').data('filter'); if (filter) { wall.filter(filter); } else { wall.unFilter(); } }); wall.fitWidth(); } /*---------- Portfolio End here -----------*/ }) // Window load end here