38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
$(function() {
|
|
$(window).on('popstate', function(event) {
|
|
var data = event.state;
|
|
$('#services ul > li.active').removeClass('active');
|
|
});
|
|
$(window).on('hashchange', function(event) {
|
|
if (location.hash && location.hash.length > 1) {
|
|
$('#services ul > li.active').removeClass('active');
|
|
$(location.hash).addClass('active');
|
|
} else {
|
|
$('#services ul > li.active').removeClass('active');
|
|
}
|
|
});
|
|
$(window).on('load', function(event) {
|
|
if (location.hash && location.hash.length > 1) {
|
|
$(window).trigger('hashchange');
|
|
}
|
|
});
|
|
|
|
$('a#menu').click(function() { $('#nav-user').hide(); $('#nav-site').toggle('slide'); });
|
|
$('a#gear').click(function() { $('#nav-site').hide(); $('#nav-user').toggle('slide'); });
|
|
$('#services li').click(function() {
|
|
$(this).find('strong').click();
|
|
});
|
|
$('#services ul strong').click(function() {
|
|
var is_already_active = $(this).parent().hasClass('active');
|
|
var title = $(this).text();
|
|
$('#services ul > li.active').removeClass('active');
|
|
if (is_already_active) {
|
|
history.pushState(document.title, document.title, '#');
|
|
} else {
|
|
history.pushState(title, title, '#'+$(this).parent().attr('id'));
|
|
$(this).parent().addClass('active');
|
|
}
|
|
return false;
|
|
});
|
|
});
|