Browse Source

Peaceful conflict resolution

master
imakewebthings 10 years ago
parent
commit
bf768811e8
  1. 5
      extensions/hash/deck.hash.js
  2. 5
      extensions/navigation/deck.navigation.js

5
extensions/hash/deck.hash.js

@ -110,6 +110,7 @@ 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');
@ -117,9 +118,9 @@ slide.
$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);
}
});

5
extensions/navigation/deck.navigation.js

@ -18,15 +18,16 @@ This module adds clickable previous and next links to the deck.
last = $[deck]('getSlides').length - 1,
prevSlide = $[deck]('getSlide', to - 1),
nextSlide = $[deck]('getSlide', to + 1),
hrefBase = window.location.href.replace(/#.*/, ''),
prevId = prevSlide ? prevSlide.attr('id') : undefined,
nextId = nextSlide ? nextSlide.attr('id') : undefined;
$(opts.selectors.previousLink)
.toggleClass(opts.classes.navDisabled, !to)
.attr('href', '#' + (prevId ? prevId : ''));
.attr('href', hrefBase + '#' + (prevId ? prevId : ''));
$(opts.selectors.nextLink)
.toggleClass(opts.classes.navDisabled, to === last)
.attr('href', '#' + (nextId ? nextId : ''));
.attr('href', hrefBase + '#' + (nextId ? nextId : ''));
};
/*

Loading…
Cancel
Save