hueman/assets/front/js/scripts.js
nikeo 6f0b21e67d = 3.1.2 May 3rd 2016 =
* fixed : Language Label in Translation Files
* fixed : the author name links to the post itself
* fixed : Featured post slider controls (arrows) overflow content container when blog heading is disabled
* fixed : Header image alt attribute is empty.
* fixed : Change Default Widget Names and CSS id properties. Could be in collision with some plugins
* added : Featured posts : new option to display the full content (instead of the excerpt) of the featured posts. Modified template : content-featured.php.
* added : Featured posts : swipe gesture supported on mobile devices like tablets and smartphones
* added : Customizer : Pre setup step when adding a new widget zone or social icons.
* improved : Customizer user interface have been improved for the social links and the widget zones. It's now easier to drag, edit and remove items.
* improved : Introduced a pluggable function ( hu_print_placeholder_thumb() )to print the placeholder thumbnail. Modified templates : content-featured.php, content.php, parts/related-posts.php
* updated : jQuery FlexSider to v2.6.0 (latest). Support swipe touch navigation
* changed : Header widget and full width footer widget are now enabled by default
* changed : The footer-ads option has been moved in the Footer Design section. The title and description of this setting have been clarified.
2016-05-03 15:07:02 +02:00

135 lines
No EOL
3.7 KiB
JavaScript

/*
scripts.js
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Copyright: (c) 2013-2015 Alexander "Alx" Agnarson, 2015 Nicolas GUILLAUME (nikeo)
*/
jQuery( function($) {
"use strict";
/* Toggle header search
/* ------------------------------------ */
$('.toggle-search').click(function(){
$('.toggle-search').toggleClass('active');
$('.search-expand').fadeToggle(250);
setTimeout(function(){
$('.search-expand input').focus();
}, 300);
});
/* Scroll to top
/* ------------------------------------ */
$('a#back-to-top').click(function() {
$('html, body').animate({scrollTop:0},'slow');
return false;
});
/* Tabs widget
/* ------------------------------------ */
(function() {
var $tabsNav = $('.alx-tabs-nav'),
$tabsNavLis = $tabsNav.children('li'),
$tabsContainer = $('.alx-tabs-container');
$tabsNav.each(function() {
var $this = $(this);
$this.next().children('.alx-tab').stop(true,true).hide()
.siblings( $this.find('a').attr('href') ).show();
$this.children('li').first().addClass('active').stop(true,true).show();
});
$tabsNavLis.on('click', function(e) {
var $this = $(this);
$this.siblings().removeClass('active').end()
.addClass('active');
$this.parent().next().children('.alx-tab').stop(true,true).hide()
.siblings( $this.find('a').attr('href') ).fadeIn();
e.preventDefault();
}).children( window.location.hash ? 'a[href="' + window.location.hash + '"]' : 'a:first' ).trigger('click');
})();
/* Comments / pingbacks tabs
/* ------------------------------------ */
$(".comment-tabs li").click(function() {
$(".comment-tabs li").removeClass('active');
$(this).addClass("active");
$(".comment-tab").hide();
var selected_tab = $(this).find("a").attr("href");
$(selected_tab).fadeIn();
return false;
});
/* Table odd row class
/* ------------------------------------ */
$('table tr:odd').addClass('alt');
/* Sidebar collapse
/* ------------------------------------ */
$('body').addClass('s1-collapse');
$('body').addClass('s2-collapse');
$('.s1 .sidebar-toggle').click(function(){
$('body').toggleClass('s1-collapse').toggleClass('s1-expand');
if ($('body').is('.s2-expand')) {
$('body').toggleClass('s2-expand').toggleClass('s2-collapse');
}
});
$('.s2 .sidebar-toggle').click(function(){
$('body').toggleClass('s2-collapse').toggleClass('s2-expand');
if ($('body').is('.s1-expand')) {
$('body').toggleClass('s1-expand').toggleClass('s1-collapse');
}
});
/* Dropdown menu animation
/* ------------------------------------ */
$('.nav ul.sub-menu').hide();
$('.nav li').hover(
function() {
$(this).children('ul.sub-menu').slideDown('fast');
},
function() {
$(this).children('ul.sub-menu').hide();
}
);
/* Mobile menu smooth toggle height
/* ------------------------------------ */
$('.nav-toggle').on('click', function() {
slide($('.nav-wrap .nav', $(this).parent()));
});
function slide(content) {
var wrapper = content.parent();
var contentHeight = content.outerHeight(true);
var wrapperHeight = wrapper.height();
wrapper.toggleClass('expand');
if (wrapper.hasClass('expand')) {
setTimeout(function() {
wrapper.addClass('transition').css('height', contentHeight);
}, 10);
}
else {
setTimeout(function() {
wrapper.css('height', wrapperHeight);
setTimeout(function() {
wrapper.addClass('transition').css('height', 0);
}, 10);
}, 10);
}
wrapper.one('transitionEnd webkitTransitionEnd transitionend oTransitionEnd msTransitionEnd', function() {
if(wrapper.hasClass('open')) {
wrapper.removeClass('transition').css('height', 'auto');
}
});
}
});