Skip to content

Commit

Permalink
Updating hash plugin to behave correctly in the presence of <base> tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyBanks committed Jun 25, 2012
1 parent 9accb16 commit a4e4c85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions extensions/hash/deck.hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,17 @@ slide.
/* Update permalink, address bar, and state class on a slide change */
.bind('deck.change', function(e, from, to) {
var hash = '#' + $[deck]('getSlide', to).attr('id'),
hashPath = window.location.href.replace(/#.*/, '') + hash,
opts = $[deck]('getOptions'),
osp = opts.classes.onPrefix,
$c = $[deck]('getContainer');

$c.removeClass(osp + $[deck]('getSlide', from).attr('id'));
$c.addClass(osp + $[deck]('getSlide', to).attr('id'));

$(opts.selectors.hashLink).attr('href', hash);
$(opts.selectors.hashLink).attr('href', hashPath);
if (Modernizr.history) {
window.history.replaceState({}, "", hash);
window.history.replaceState({}, "", hashPath);
}
});

Expand Down

0 comments on commit a4e4c85

Please sign in to comment.