Updating hash plugin to behave correctly in the presence of <base> tag.
This commit is contained in:
parent
9accb16013
commit
a4e4c8540f
1 changed files with 3 additions and 2 deletions
|
@ -110,6 +110,7 @@ slide.
|
||||||
/* Update permalink, address bar, and state class on a slide change */
|
/* Update permalink, address bar, and state class on a slide change */
|
||||||
.bind('deck.change', function(e, from, to) {
|
.bind('deck.change', function(e, from, to) {
|
||||||
var hash = '#' + $[deck]('getSlide', to).attr('id'),
|
var hash = '#' + $[deck]('getSlide', to).attr('id'),
|
||||||
|
hashPath = window.location.href.replace(/#.*/, '') + hash,
|
||||||
opts = $[deck]('getOptions'),
|
opts = $[deck]('getOptions'),
|
||||||
osp = opts.classes.onPrefix,
|
osp = opts.classes.onPrefix,
|
||||||
$c = $[deck]('getContainer');
|
$c = $[deck]('getContainer');
|
||||||
|
@ -117,9 +118,9 @@ slide.
|
||||||
$c.removeClass(osp + $[deck]('getSlide', from).attr('id'));
|
$c.removeClass(osp + $[deck]('getSlide', from).attr('id'));
|
||||||
$c.addClass(osp + $[deck]('getSlide', to).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) {
|
if (Modernizr.history) {
|
||||||
window.history.replaceState({}, "", hash);
|
window.history.replaceState({}, "", hashPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue