Slider Revolution WP
09.27.2016
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
jQuery(document).ready(function() { var page = jQuery('#page'), menuItems = jQuery('#site-navigation .menu-item').on('click', function() { var $this = jQuery(this); // bounce if current page's menu item is clicked if($this.hasClass('current-menu-item') || page.hasClass('cj-loading')) return false; // update menu item styles menuItems.removeClass('current-menu-item'); $this.addClass('current-menu-item'); // show CSS-based page-change preloader page.addClass('cj-loading'); // retrieve new page's contents jQuery.ajax($this.children('a').attr('href')).done(function(data) { // hide preloader page.removeClass('cj-loading'); // load contents from new pages "#primary" div into current page's "#content" div jQuery('#content').html(jQuery(data).find('#primary')); }); // prevent normal link behavior return false; }); }); |