Skip to content

Commit

Permalink
Merge pull request #50 from chakler/master
Browse files Browse the repository at this point in the history
Changed from pushState to replaceState
  • Loading branch information
impallari committed Jun 26, 2015
2 parents bfcc274 + 6aff970 commit fcfd2f8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
43 changes: 36 additions & 7 deletions js/init.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,48 @@
$(document).ready(function(){
$(document).ready(function(){

// Tabs
var tabContainers = $('div.tabs > div');
$('div.tabs ul.tabNavigation a').click(function () {
tabContainers.hide().filter(this.hash).show();

function tabTrigger(link, hash) {
tabContainers.hide().filter(hash).show();
$('div.tabs ul.tabNavigation a').removeClass('selected');
$(this).addClass('selected');
link.addClass('selected');
}

if (location.hash) {
// Make sure page jump back to top
setTimeout(function() {
window.scrollTo(0, 0);
}, 1);
}

if (window.location.hash) {
var hash = window.location.hash
link = $('div.tabs ul.tabNavigation a[href="'+hash+'"]');
tabTrigger(link, hash);
} else {
var link = $('div.tabs ul.tabNavigation a').filter(':first'),
hash = link.attr('href');
tabTrigger(link, hash);
};

$('div.tabs ul.tabNavigation a').click(function (event) {
var link = $(this),
hash = link.attr('href');
tabTrigger(link, hash);
// History API
if(history.replaceState) {
history.replaceState(null, null, hash);
};
event.preventDefault();
return false;
}).filter(':first').click();
});

// OT Features Panel
$('#showhide').click(function () {
$('#otfeatures').slideToggle("fast", function() {
$("#showhide").text($(this).is(':visible') ? "Hide OpenType Features" : "OpenType Features");
});
$("#showhide").text($(this).is(':visible') ? "Hide OpenType Features" : "OpenType Features");
});
});

// OT Features initial Run
Expand Down

0 comments on commit fcfd2f8

Please sign in to comment.