mirror of
https://github.com/Noratrieb/slides.git
synced 2026-01-15 00:45:07 +01:00
write named links, rather than h/v index, to hash when available (closes #224)
This commit is contained in:
parent
f6c5ceb490
commit
df4e1fd346
2 changed files with 14 additions and 9 deletions
15
js/reveal.js
15
js/reveal.js
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* reveal.js 2.2 r38
|
||||
* reveal.js 2.2 r39
|
||||
* http://lab.hakim.se/reveal-js
|
||||
* MIT licensed
|
||||
*
|
||||
|
|
@ -938,10 +938,15 @@ var Reveal = (function(){
|
|||
if( config.history ) {
|
||||
var url = '/';
|
||||
|
||||
// Only include the minimum possible number of components in
|
||||
// the URL
|
||||
if( indexh > 0 || indexv > 0 ) url += indexh;
|
||||
if( indexv > 0 ) url += '/' + indexv;
|
||||
// If the current slide has an ID, use that as a named link
|
||||
if( currentSlide && typeof currentSlide.getAttribute( 'id' ) === 'string' ) {
|
||||
url = '/' + currentSlide.getAttribute( 'id' );
|
||||
}
|
||||
// Otherwise use the /h/v index
|
||||
else {
|
||||
if( indexh > 0 || indexv > 0 ) url += indexh;
|
||||
if( indexv > 0 ) url += '/' + indexv;
|
||||
}
|
||||
|
||||
window.location.hash = url;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue