mirror of
https://ghproxy.net/https://github.com/AlxMedia/splits.git
synced 2025-08-26 11:09:49 +08:00
Initial commit
This commit is contained in:
commit
9f13aa6240
389 changed files with 84369 additions and 0 deletions
168
js/scripts.js
Normal file
168
js/scripts.js
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
scripts.js
|
||||
|
||||
License: GNU General Public License v3.0
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Copyright: (c) 2013 Alexander "Alx" Agnarson, http://alx.media
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
/* Toggle header search
|
||||
/* ------------------------------------ */
|
||||
$('.toggle-search').on('click', function() {
|
||||
$('.toggle-search').toggleClass('active');
|
||||
$('.search-expand').fadeToggle(250);
|
||||
setTimeout(function(){
|
||||
$('.search-expand input').focus();
|
||||
}, 300);
|
||||
});
|
||||
|
||||
/* Scroll to top
|
||||
/* ------------------------------------ */
|
||||
$('a#back-to-top').on('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').on('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').on('click', function() {
|
||||
$('body').toggleClass('s1-collapse').toggleClass('s1-expand');
|
||||
if ($('body').is('.s2-expand')) {
|
||||
$('body').toggleClass('s2-expand').toggleClass('s2-collapse');
|
||||
}
|
||||
});
|
||||
$('.s2 .sidebar-toggle').on('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();
|
||||
}
|
||||
);
|
||||
|
||||
/* Fitvids
|
||||
/* ------------------------------------ */
|
||||
function responsiveVideo() {
|
||||
if ( $().fitVids ) {
|
||||
$('#wrapper').fitVids();
|
||||
}
|
||||
}
|
||||
|
||||
responsiveVideo();
|
||||
|
||||
/* Owl Carousel
|
||||
/* ------------------------------------ */
|
||||
$("#owl-featured").owlCarousel({
|
||||
navigation : false,
|
||||
items : 6,
|
||||
itemsDesktop : [1440,4],
|
||||
itemsDesktopSmall : [1024,3],
|
||||
itemsTablet: [768,3],
|
||||
itemsTabletSmall: [568,2],
|
||||
itemsMobile : [479,1],
|
||||
});
|
||||
|
||||
/* 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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Social count plus override
|
||||
/* ------------------------------------ */
|
||||
$('.social-count-plus ul li span').attr('style', 'color: #fff');
|
||||
|
||||
/* Stickyfill
|
||||
/* ------------------------------------ */
|
||||
if ($(window).width() >= 1024){
|
||||
$('.stickyfill').Stickyfill();
|
||||
}
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue