/** * Functionality specific to i-max. * * Provides helper functions to enhance the theme experience. */ ( function( $ ) { var body = $( 'body' ), _window = $( window ); /** * Enables menu toggle for small screens. */ ( function() { var nav = $( '#site-navigation' ), button, menu; if ( ! nav ) return; button = nav.find( '.menu-toggle' ); if ( ! button ) return; // Hide button if menu is missing or empty. menu = nav.find( '.nav-container' ); if ( ! menu || ! menu.children().length ) { button.hide(); return; } $( '.menu-toggle' ).on( 'click.imax', function() { //nav.toggleClass( 'toggled-on' ); } ); } )(); /** * Makes "skip to content" link work correctly in IE9 and Chrome for better * accessibility. * * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ */ _window.on( 'hashchange.imax', function() { var element = document.getElementById( location.hash.substring( 1 ) ); if ( element ) { if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) element.tabIndex = -1; element.focus(); } } ); } )( jQuery ); /* scripts to run on document ready */ jQuery(document).ready(function($) { /* customizing the drop down menu */ jQuery('div.nav-container > ul > li > a').append( '' ); jQuery('div.nav-container ul > li').hover(function() { jQuery(this).children('ul.children,ul.sub-menu').stop(true, true).slideDown("fast"); }, function(){ jQuery(this).children('ul.children,ul.sub-menu').slideUp("fast"); }); jQuery('.search-form').append( '' ); /* adding class for no featured image posts */ $( "div.entry-nothumb" ).parent(".meta-img").addClass("no-image-meta"); /* Go to top button */ jQuery('body').append(''); // Show or hide the sticky footer button jQuery(window).scroll(function() { if (jQuery(this).scrollTop() > 200) { jQuery('.go-top').fadeIn(200).addClass( 'bounce' ); } else { jQuery('.go-top').fadeOut("slow"); } }); // Animate the scroll to top jQuery('.go-top').click(function(event) { event.preventDefault(); jQuery('html, body').animate({scrollTop: 0}, 1000); }); /* Side responsive menu */ $('.menu-toggle').sidr({ name: 'sidr-left', side: 'left', source: '.nav-container', onOpen: function() { $('.menu-toggle').animate({ marginLeft: "260px" }, 200); }, onClose: function() { $('.menu-toggle').animate({ marginLeft: "0px" }, 200); } }); $(window).resize(function () { if ($(window).width() > 1070) { $.sidr('close', 'sidr-left'); } equalheight('#ft-post article'); }); /*equal height for featured post for two column view */ equalheight = function(container){ var currentTallest = 0, currentRowStart = 0, rowDivs = new Array(), $el, topPosition = 0; $(container).each(function() { $el = $(this); $($el).height('auto') topPostion = $el.position().top; if (currentRowStart != topPostion) { for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } rowDivs.length = 0; // empty the array currentRowStart = topPostion; currentTallest = $el.height(); rowDivs.push($el); } else { rowDivs.push($el); currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); } for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } }); } equalheight('.main article'); /* $(window).scroll(function(){ var newvalue = parseInt($(this).scrollTop()*0.25)-64; $('.ibanner').css('background-position', '0px '+newvalue+'px'); }); */ $(window).load(function(){ // footer area masonry $('#footer-widgets').each(function () { $(this).masonry({}); }); // Two column Blog layout masonry $('#blog-cols').each(function () { $(this).masonry({}); }); }); // slider $('#da-slider').each(function() { _this = $(this); var slider_speed = _this.data('slider-speed'); _this.owlCarousel({ navigation : true, autoPlay : slider_speed, paginationSpeed : 600, singleItem: true, rewindSpeed: 600, stopOnHover: true, navigationText: ['',''], addClassActive: true, theme : "owl-theme1", goToFirstSpeed : 1000, slideSpeed : 600, autoHeight: true }); }); if ( $('.ibanner').length > 0 ) { var slider_parallax = $('#da-slider').data('slider-parallax'); if (slider_parallax == 1) { var slidetop = parseInt($('.ibanner').offset().top); if( $( window ).width() > 999 ) { $(window).scroll(function(){ //var newvalue = parseInt($(this).scrollTop()*0.25)-64; var newvalue = parseInt($(this).scrollTop()*0.70)-100; if ($(this).scrollTop() > slidetop) { $('.da-img img').css('margin-top', newvalue+'px'); } if ($(this).scrollTop() <= slidetop) { var slideheight = $('.active .da-img img').height(); $('.da-img img').css('margin-top', 0+'px'); $('.owl-wrapper-outer').css('max-height', slideheight+'px'); } //console.log('margin-top : '+newvalue+'px, ' + 'SlideTop : ' +slidetop+'px, ' + 'Scrolltop : ' +$(this).scrollTop()+'px'); }); } } } /**/ }); /* scripts to run as loads */ (function($) { /* no utility bar class addition */ if ( $('.utilitybar').length == 0 ) { $('.headerwrap').addClass('noutility'); } /* featured post on scroll animation $('div#featured .post').css("opacity","0.0"); $('div#featured').waypoint(function() { $( "div#featured .post" ).each(function(index) { var _this = $(this); setTimeout( function () { $('div#featured .post').show(); _this.addClass( 'animated fadeInUp' ); _this.css("opacity","1.0"); }, (index+1) * 200); }); }, { offset: '100%', triggerOnce: true }); */ /* $('#primary .entry-thumbnail').waypoint(function() { $(this).addClass( 'animated fadeInLeft' ); }, { offset: '100%', triggerOnce: true }); $('div#primary div.post-mainpart').waypoint(function() { $(this).addClass( 'animated fadeInUp' ); }, { offset: '100%', triggerOnce: true }); */ })(jQuery); /**/