// 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(index1200){ cols = 4; }else if(windowWidth>992){ cols = 3; }else if(windowWidth>768){ cols = 2; }else if(windowWidth>640){ cols = 1; } if(cols>maxCol) cols = maxCol; // alert(windowWidth + " : " + cols); return cols; } var applyMasonry = function () { if ($(".masonry")[0]){ var msnry; var $parent = $('.masonry').parent(); var container = document.querySelector('.masonry'); imagesLoaded( '.masonry', function() { msnry = new Masonry( container, { // options columnWidth: '.grid-sizer', itemSelector: '.box-item', layoutMode: 'fitRows', }); $( window ).resize(function(){ msnry.destroy(); msnry = new Masonry( container, { // options columnWidth: '.grid-sizer', itemSelector: '.box-item', layoutMode: 'fitRows' }); msnry.layout(); }); }); var $loading = false, $finished = false, page = $(container).data("page")!='undefined' ? $(container).data("page") : 1, total_posts = $(container).data("total"), loaded_posts = $(container).children().length, count = $(container).data("count"), category = $(container).data("cat"), tag = $(container).data("tag"), month = $(container).data("month"), year = $(container).data("year"), show_loadmore = $(container).data("loadmore"), enable_image_zoom = $(container).data("zoom"), author = $(container).data("author"), search = $(container).data("search"), max_pages = $(container).data("pages"); // ajax loading for masonry var load_posts = function () { // create new item elements var elems = []; $parent.find('.spinner-container').show(); $parent.find('.icon-plus').hide(); $loading = true; $.ajax({ type: "GET", url: getContextPath() + "wp-admin/admin-ajax.php", dataType: 'html', data: ({ action: 'amanda_load_posts', category: category, author: author, search: search, tag: tag, month: month, year: year, page: page, count: count, zoom: enable_image_zoom }), success: function(data){ $posts_data = $('' + data + ''); loaded_posts = 0; var fragment = document.createDocumentFragment(); if (data.length > 1) { $posts_data.children().each(function(){ fragment.appendChild(this); elems.push(this); loaded_posts++; }); if(loaded_posts= Math.round(content_offset.top - ($window.height() - 50)) && pagemax) { // load_posts(); // } }); }*/ } //check if masonry is used }// applyMasonry // ------------------------------------------------------------------------------ // // On document ready // ------------------------------------------------------------------------------ // $(document).ready(function() { $window = $(window); // remove the preloader if it takes more than 30 seconds to load removePreloader(); // setTimeout(function(){ // removePreloader(); // }, 30000); init_video(); // $('.site-menu, .section-nav-up, .section-nav-down').disableTextSelect(); $('.mcp-menu .menu-item-has-children').each(function(){ var $menu = $(this); $menu.children('a').click(function(){ $menu.children('ul').slideToggle(200); $menu.toggleClass('active'); return false; }); }); // var menu_is_visible = false; $('.site-menu, .site-nav .site-nav-close').click( function(){ $('body').toggleClass('site-nav-open'); // menu_is_visible = !menu_is_visible; // show_menu(menu_is_visible); }); $('.site-nav-overlay').click( function(){ $('body').removeClass('site-nav-open'); // menu_is_visible = false; // show_menu(menu_is_visible); }); // ------------------------------------------------------------------------------ // // Accordion Settings // // ------------------------------------------------------------------------------ // jQuery(function() { jQuery( ".accordion" ).accordion({ animate: "easeInOutExpo", collapsible: $(this).data('active-tab'), active: $(this).data('active-tab'), icons: "", heightStyle: "content" }); }); jQuery(function() { jQuery(".mcp-toggle").find(".accordion-title").hover(function () { jQuery(this).toggleClass("ui-state-hover") }).click(function () { jQuery(this).toggleClass("ui-state-active").next().toggleClass("ui-accordion-content-active").slideToggle(200); return false; }); }); jQuery(function() { jQuery(".tabs-nav").each(function() { jQuery(this).next().children(".tab-content").hide(); //Hide all content jQuery(this).children("li").first().addClass("active").show(); //Activate first tab jQuery(this).next().children(".tab-content").first().show(); //Show first tab content }); //On Click Event jQuery(".tabs-nav li").click(function(e) { jQuery(this).siblings().removeClass("active"); //Remove any "active" class jQuery(this).addClass("active"); //Add "active" class to selected tab jQuery(this).parent().next().children(".tab-content").hide(); //Hide all tab content var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content jQuery(this).parent().next().find(activeTab).fadeIn(); //Fade in the active ID content e.preventDefault(); }); jQuery(".tabs-nav li a").click(function(e) { e.preventDefault(); }) }); // ------------------------------------------------------------------------------ // // Counters // // ------------------------------------------------------------------------------ // $('.timer').waypoint(function(){ $('.timer').each(count); }, {offset:$.waypoints('viewportHeight')+200,triggerOnce: true}); function count(options) { var $this = $(this); options = $.extend({}, options || {}, $this.data('countToOptions') || {}); $this.countTo(options); $this.addClass("done"); } // ------------------------------------------------------------------------------ // // EasyPieChart // // ------------------------------------------------------------------------------ // $('.chart').waypoint(function(){ $('.chart').each(function(){ var color = $(this).data('color'); var width = $(this).data('width'); var size = $(this).data('size'); var chart = $(this).easyPieChart({ //your configuration goes here animate: 2000, lineWidth: width, size: size, scaleColor: false, barColor: color, lineCap: 'butt' //butt, round, square. }); }); }, {offset:$.waypoints('viewportHeight')+200,triggerOnce: true}); // ------------------------------------------------------------------------------ // // main menu // // ------------------------------------------------------------------------------ // $('.main-menu li.menu-item > a').click(function(){ $('.main-menu li.menu-item.active').removeClass('active'); $(this).parent().addClass('active'); }); // ------------------------------------------------------------------------------------------- // // Animated Scroll To Top // // ------------------------------------------------------------------------------------------- // $(function () { $(window).scroll(function () { if ($(this).scrollTop() > $(window).height()) { $('.nav-top .site-nav-top').addClass('sticky'); // $('#scroll-top').fadeIn(); } else { $('.nav-top .site-nav-top').removeClass('sticky'); // $('#scroll-top').fadeOut(); } // sticky sidebar if ( $(document).height() > $('.main-sidebar').height() ) { if ($(this).scrollTop() > $('.main-sidebar').height() - $(window).height() ) { $('.no-mobile.nav-sidebar .main-sidebar').addClass('sticky'); } else { $('.no-mobile.nav-sidebar .main-sidebar').removeClass('sticky'); } } }); // scroll body to 0px on click $('a.top').click(function () { $('body,html').animate({ scrollTop: 0 }, 800); return false; }); }); // Divider Top $(".divider a.top").click(function() { $('html, body').animate({scrollTop:0}, 'slow'); return false; }); // ------------------------------------------------------------------------------ // // Flickr Plugin Settings // // ------------------------------------------------------------------------------ // (function() { $('.flickr-wrap').each(function(){ $(this).jflickrfeed({ limit: $(this).data('limit'), qstrings: { id: $(this).data('id') }, itemTemplate: '
  • {{title}}
  • ' }); }); })(); }); // document ready // jQuery(window).load(function(){ // removePreloader(); // }); jQuery(window).resize(function(){ init_fit_videos(); init_parallax_sections(); $.waypoints('refresh'); }); })(jQuery);