// here $ would be point to jQuery object (function($) { // check if it's mobile window.mobilecheck = function() { var check = false; (function(a,b){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); return check; } // remove preloader and init functions removePreloader = function() { // if( $('.preloader-wrapper').is(":visible") ) { if( window.mobilecheck() ){ $('body').addClass('mobile'); }else{ $('body').addClass('no-mobile'); } init_carousel(); init_fit_videos(); init_parallax_sections(); init_swipebox(); applyMasonry(); init_justified_gallery(); add_navigation_dots(); init_waypoints(); init_portfolio_details(); $('.tool-tip').tooltip(); $.waypoints('refresh'); $('body.nav-pagination').scrollspy({ target:'.section-navigation'}); $('body.nav-top').scrollspy({ target:'.site-nav-top'}); if ( !$.browser.webkit ) { $(".no-mobile.nav-pagination.nav-left .site-nav .scrollable").niceScroll({cursorcolor:"#111",zindex:420,cursoropacitymax:0.5,cursorwidth:8,cursorborder:false}); } //smooth scroll for one page menu $('.section-navigation').css({marginTop: -$('.section-navigation').innerHeight()/2}); $('.nav-top .site-nav-top a').smoothScroll({speed: 600, easing : 'easeOutExpo', offset : -80}); $('.section-navigation a').smoothScroll({speed: 600, easing : 'easeOutExpo'}); $('.portfolio-details.floating .btn-close').click(function(){ $(this).parent().toggleClass('open'); $(this).parent().toggleClass('closed'); return false; }); // remove the preloader $('.preloader-wrapper').fadeOut(600, "easeOutCubic"); vc_progress_bar(); // } } function add_navigation_dots() { var navside = 'nav-left', strOutput = ''; var strTooltip = ( navside=='nav-right' ) ? 'left' : 'right'; strOutput = '
"; $('.site-navigation .section-navigation').html( strOutput ); } /* Progress bar ---------------------------------------------------------- */ if (typeof window['vc_progress_bar'] !== 'function') { window.vc_progress_bar = function() { if (typeof jQuery.fn.waypoint !== 'undefined') { jQuery('.vc_progress_bar').waypoint(function () { jQuery(this).find('.vc_single_bar').each(function (index) { var $this = jQuery(this), bar = $this.find('.vc_bar'), val = bar.data('percentage-value'); setTimeout(function () { bar.css({"width":val + '%'}); }, index * 200); }); }, { offset:'85%' }); } } } // ------------------------------------------------------------------------------ // // force equal heights // // ------------------------------------------------------------------------------ // forceEqualHeights = function( container, element ){ $(container).each(function(){ // equal heights for all the carousel items var maxheight = 0; // alert( container+" : "+maxheight); $(this).find(element).css('min-height', '0px'); $(this).find(element).each(function(){ // alert($(this).innerHeight()); if( $(this).innerHeight()>maxheight ) maxheight = $(this).innerHeight(); }); // $('.equal-heights figure, .equal-heights .icon-box').css('min-height', '0'); $(this).find(element).css('min-height', maxheight+'px'); }); } // ------------------------------------------------------------------------------ // // fit fullscreen elements // // ------------------------------------------------------------------------------ // fit_fullscreen_elements = function(){ var pageWidth = $window.width() - 80; $('.fullscreen .posts-slider.owl-carousel .owl-stage-outer').css({maxWidth:pageWidth}); $( window ).resize(function(){ pageWidth = $window.width() - 80; $('.fullscreen .posts-slider.owl-carousel .owl-stage-outer').css({maxWidth:pageWidth}); }); } // ------------------------------------------------------------------------------ // // scroll portfolio details // // ------------------------------------------------------------------------------ // init_portfolio_details = function(){ // scroll portfolio details $window.scroll(function () { var $details = $('.single-portfolio .portfolio-two-col .portfolio-details'); var firstTop = $window.scrollTop(); var windowHeight = $window.height(); if( firstTop < ($('.single-portfolio .portfolio-two-col .portfolio-content').innerHeight()-$details.height()) ) $details.css({top: firstTop}); }); } // ------------------------------------------------------------------------------ // // fit videos // // ------------------------------------------------------------------------------ // init_fit_videos = function(){ $(".main-article, .portfolio-content").fitVids(); $(".wpb_video_wrapper, .video, .audio").fitVids(); $(".post-image.video .fluid-width-video-wrapper").fitVids(); } // ------------------------------------------------------------------------------ // // justified gallery // // ------------------------------------------------------------------------------ // init_justified_gallery = function(){ $('.justified-gallery').each(function(){ $(this).justifiedGallery({ lastRow : 'nojustify', rowHeight : 250, rel : 'gallery1', margins : 10 }) }); // $('.gallery').justifiedGallery({ // lastRow : 'nojustify', // rowHeight : 250, // rel : 'gallery1', // margins : 10 // }) } // ------------------------------------------------------------------------------ // // parallax effect // // ------------------------------------------------------------------------------ // init_parallax_sections = function() { $('.no-mobile .parallax').each(function(){ setTimeout( $(this).parallax("-10", 0.4), 500); }); } // ------------------------------------------------------------------------------ // // Owl Carousel // // ------------------------------------------------------------------------------ // init_carousel = function() { $('.post-image .gallery').owlCarousel({ items:1, autoHeight:false, autoplay: false, dots: false, nav: true, navText:['',''] }); imagesLoaded( '.no-mobile .carousel, .mobile .mobile-ok .carousel', function() { $(".no-mobile .carousel, .mobile .mobile-ok .carousel").each(function(){ var $carousel = $(this); var no_of_items = ($(this).data('count')) ? $(this).data('count') : 1; var transitionIn = ($(this).data('transitionin')) ? $(this).data('transitionin') : 'fadeOut'; var transitionOut = ($(this).data('transitionout')) ? $(this).data('transitionout') : 'fadeOut'; var pagination = $(this).data('pagination'); var navigation = $(this).data('navigation'); var autoplay = ($(this).data('autoplay')==true) ? true : false; var autoHeight = ($(this).data('autoHeight')) ? true : false; var margin = ($(this).data('margin')) ? $(this).data('margin') : 0; if(no_of_items==1){ $carousel.owlCarousel({ items:1, autoHeight:true, autoplay: autoplay, dots: pagination, nav: navigation, navText:['',''], autoplayHoverPause: true, animateIn: transitionIn, animateOut: transitionOut }); }else { $carousel.owlCarousel({ loop:true, margin:margin, autoplay: autoplay, dots: pagination, nav: navigation, autoplayHoverPause: true, responsive:{ 0:{ items:1}, 600:{items:1}, 1000:{items:no_of_items} } }); } $(".tweet-slider .tweet_list").owlCarousel({ items : 1, animateOut: 'fadeOut' }); $(".posts-slider").owlCarousel({ loop:true, items : 1, dots : false, nav: true, navText:['',''], autoplay: false }); init_fit_videos(); $carousel.parent().find('.owl-prev, .owl-next').disableTextSelect(); // $carousel.parent().find('.owl-prev').click(function(){ // $carousel.trigger('prev.owl.carousel'); // alert('ok'); // }); // $carousel.parent().find('.owl-next').click(function(){ // $carousel.trigger('next.owl.carousel'); // }); }); }); // imagesLoaded } // ------------------------------------------------------------------------------ // // init swipebox // // ------------------------------------------------------------------------------ // init_swipebox = function() { $( '.swipebox, .gallery-item a' ).swipebox(); } // ------------------------------------------------------------------------------ // //animate the main menu // ------------------------------------------------------------------------------ // show_menu = function(show) { //, .site-nav-scrollable-container .widget ul li $menuitems = $('.multi-level-nav .mcp-menu li'); $sitelogo = $('.site-nav .logo'); var marginLeft, opacity, easing; if(show){ marginLeft = '0px'; opacity = 1; easing = 'easeOutBack'; } else { marginLeft = '40px'; opacity = 0; easing = 'easeInBack'; } $sitelogo.delay(300).animate({ marginLeft : marginLeft, opacity : opacity }, 500, easing, function(){ }); $menuitems.each(function(i){ $(this).stop().delay(300 + i * 100).animate({ marginLeft : marginLeft, opacity : opacity }, 500, easing, function(){ // if(i === totalItems - 1) // dfd.resolve(); }); }) } // ------------------------------------------------------------------------------ // // waypoints // // ------------------------------------------------------------------------------ // init_waypoints = function(){ var $active, $prev, $next; $('.page-wrap .section').each(function(){ if( $(this).innerHeight()>10 ) { $(this).waypoint( function(direction) { $active = $(this); $prev = ( $active.prev().innerHeight()>10 ) ? $active.prev() : $active.prev().prev(); $next = ( $active.next().innerHeight()>10 ) ? $active.next() : $active.next().next(); if (direction === "up") { $active = ( $active.prev().innerHeight()>10 ) ? $active.prev() : $active.prev().prev(); $prev = ( $active.prev().innerHeight()>10 ) ? $active.prev() : $active.prev().prev(); $next = ( $active.next().innerHeight()>10 ) ? $active.next() : $active.next().next(); } $active.addClass('active'); if( $active.hasClass('dark-content') || $active.hasClass('black-content') ) { $('body').addClass('dark-nav'); }else{ $('body').removeClass('dark-nav'); } }, { offset: '50%' }); } }); if( $('body').hasClass('mouse-scroll-nav') ){ var isAnimated = false; $window.on('mousewheel', function(event) { if(!isAnimated){ var index = $('.page-wrap .section').index($active); var total = $('.page-wrap .section').length; // alert(event.deltaX+", "+event.deltaY+", "+event.deltaFactor); isAnimated = true; var settings = {margin:true}; if(event.deltaY<0){ // alert(index+'<'+total); if(index