add isVerticalSlide utility method
This commit is contained in:
1 parent
0306e0fa0d
commit
36a8f12127
2 files changed
+21
-6
No files matched your search
+19
-4
@@ -932,6 +932,22 @@ var Reveal = (function(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current or specified slide is vertical
|
||||
* (nested within another slide).
|
||||
*
|
||||
* @param {HTMLElement} slide [optional] The slide to check
|
||||
* orientation of
|
||||
*/
|
||||
function isVerticalSlide( slide ) {
|
||||
|
||||
// Prefer slide argument, otherwise use current slide
|
||||
slide = slide ? slide : currentSlide;
|
||||
|
||||
return slide && !!slide.parentNode.nodeName.match( /section/i );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handling the fullscreen functionality via the fullscreen API
|
||||
*
|
||||
@@ -1229,7 +1245,7 @@ var Reveal = (function(){
|
||||
element.style.display = distance > 3 ? 'none' : 'block';
|
||||
}
|
||||
|
||||
var reverse = config.rtl && !element.parentNode.nodeName.match( /section/gi );
|
||||
var reverse = config.rtl && !isVerticalSlide( element );
|
||||
|
||||
element.classList.remove( 'past' );
|
||||
element.classList.remove( 'present' );
|
||||
@@ -1362,7 +1378,6 @@ var Reveal = (function(){
|
||||
|
||||
// Highlight fragment directions
|
||||
if( currentSlide ) {
|
||||
var isVertical = !!currentSlide.parentNode.nodeName.match( /section/gi );
|
||||
|
||||
// Always apply fragment decorator to prev/next buttons
|
||||
if( fragments.prev ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } );
|
||||
@@ -1370,7 +1385,7 @@ var Reveal = (function(){
|
||||
|
||||
// Apply fragment decorators to directional buttons based on
|
||||
// what slide axis they are in
|
||||
if( isVertical ) {
|
||||
if( isVerticalSlide( currentSlide ) ) {
|
||||
if( fragments.prev ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } );
|
||||
if( fragments.next ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'fragmented', 'enabled' ); } );
|
||||
}
|
||||
@@ -1576,7 +1591,7 @@ var Reveal = (function(){
|
||||
|
||||
// If a slide is specified, return the indices of that slide
|
||||
if( slide ) {
|
||||
var isVertical = !!slide.parentNode.nodeName.match( /section/gi );
|
||||
var isVertical = isVerticalSlide( slide );
|
||||
var slideh = isVertical ? slide.parentNode : slide;
|
||||
|
||||
// Select all horizontal slides
|
||||
|
||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* reveal.js 2.4.0 (2013-04-29, 21:53)
|
||||
* reveal.js 2.4.0 (2013-04-29, 22:06)
|
||||
* http://lab.hakim.se/reveal-js
|
||||
* MIT licensed
|
||||
*
|
||||
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se
|
||||
*/
|
||||
var Reveal=function(){"use strict";function e(e){return kt||Tt?(window.addEventListener("load",h,!1),c(Lt,e),n(),r(),void 0):(document.body.setAttribute("class","no-transforms"),void 0)}function t(){if(xt.theme=document.querySelector("#theme"),xt.wrapper=document.querySelector(".reveal"),xt.slides=document.querySelector(".reveal .slides"),!xt.wrapper.querySelector(".progress")){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",xt.wrapper.appendChild(e)}if(!xt.wrapper.querySelector(".controls")){var t=document.createElement("aside");t.classList.add("controls"),t.innerHTML='<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>',xt.wrapper.appendChild(t)}if(!xt.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),xt.wrapper.appendChild(n)}if(!xt.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),xt.wrapper.appendChild(r)}xt.progress=document.querySelector(".reveal .progress"),xt.progressbar=document.querySelector(".reveal .progress span"),Lt.controls&&(xt.controls=document.querySelector(".reveal .controls"),xt.controlsLeft=l(document.querySelectorAll(".navigate-left")),xt.controlsRight=l(document.querySelectorAll(".navigate-right")),xt.controlsUp=l(document.querySelectorAll(".navigate-up")),xt.controlsDown=l(document.querySelectorAll(".navigate-down")),xt.controlsPrev=l(document.querySelectorAll(".navigate-prev")),xt.controlsNext=l(document.querySelectorAll(".navigate-next")))}function n(){/iphone|ipod|android/gi.test(navigator.userAgent)&&!/crios/gi.test(navigator.userAgent)&&(window.addEventListener("load",u,!1),window.addEventListener("orientationchange",u,!1))}function r(){function e(){n.length&&head.js.apply(null,n),o()}for(var t=[],n=[],r=0,a=Lt.dependencies.length;a>r;r++){var s=Lt.dependencies[r];(!s.condition||s.condition())&&(s.async?n.push(s.src):t.push(s.src),"function"==typeof s.callback&&head.ready(s.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],s.callback))}t.length?(head.ready(e),head.js.apply(null,t)):e()}function o(){t(),a(),X(),setTimeout(function(){f("ready",{indexh:Et,indexv:St,currentSlide:mt})},1)}function a(e){if(xt.wrapper.classList.remove(Lt.transition),"object"==typeof e&&c(Lt,e),Tt===!1&&(Lt.transition="linear"),xt.wrapper.classList.add(Lt.transition),xt.wrapper.setAttribute("data-transition-speed",Lt.transitionSpeed),xt.controls&&(xt.controls.style.display=Lt.controls&&xt.controls?"block":"none"),xt.progress&&(xt.progress.style.display=Lt.progress&&xt.progress?"block":"none"),Lt.rtl?xt.wrapper.classList.add("rtl"):xt.wrapper.classList.remove("rtl"),Lt.center?xt.wrapper.classList.add("center"):xt.wrapper.classList.remove("center"),Lt.mouseWheel?(document.addEventListener("DOMMouseScroll",rt,!1),document.addEventListener("mousewheel",rt,!1)):(document.removeEventListener("DOMMouseScroll",rt,!1),document.removeEventListener("mousewheel",rt,!1)),Lt.rollingLinks?v():p(),Lt.theme&&xt.theme){var t=xt.theme.getAttribute("href"),n=/[^\/]*?(?=\.css)/,r=t.match(n)[0];Lt.theme!==r&&(t=t.replace(n,Lt.theme),xt.theme.setAttribute("href",t))}M()}function s(){Ot=!0,window.addEventListener("hashchange",ut,!1),window.addEventListener("resize",ft,!1),Lt.touch&&(xt.wrapper.addEventListener("touchstart",B,!1),xt.wrapper.addEventListener("touchmove",G,!1),xt.wrapper.addEventListener("touchend",J,!1),window.navigator.msPointerEnabled&&(xt.wrapper.addEventListener("MSPointerDown",et,!1),xt.wrapper.addEventListener("MSPointerMove",tt,!1),xt.wrapper.addEventListener("MSPointerUp",nt,!1))),Lt.keyboard&&document.addEventListener("keydown",Q,!1),Lt.progress&&xt.progress&&xt.progress.addEventListener("click",ot,!1),Lt.controls&&xt.controls&&["touchstart","click"].forEach(function(e){xt.controlsLeft.forEach(function(t){t.addEventListener(e,at,!1)}),xt.controlsRight.forEach(function(t){t.addEventListener(e,st,!1)}),xt.controlsUp.forEach(function(t){t.addEventListener(e,it,!1)}),xt.controlsDown.forEach(function(t){t.addEventListener(e,ct,!1)}),xt.controlsPrev.forEach(function(t){t.addEventListener(e,lt,!1)}),xt.controlsNext.forEach(function(t){t.addEventListener(e,dt,!1)})})}function i(){Ot=!1,document.removeEventListener("keydown",Q,!1),window.removeEventListener("hashchange",ut,!1),window.removeEventListener("resize",ft,!1),xt.wrapper.removeEventListener("touchstart",B,!1),xt.wrapper.removeEventListener("touchmove",G,!1),xt.wrapper.removeEventListener("touchend",J,!1),window.navigator.msPointerEnabled&&(xt.wrapper.removeEventListener("MSPointerDown",et,!1),xt.wrapper.removeEventListener("MSPointerMove",tt,!1),xt.wrapper.removeEventListener("MSPointerUp",nt,!1)),Lt.progress&&xt.progress&&xt.progress.removeEventListener("click",ot,!1),Lt.controls&&xt.controls&&["touchstart","click"].forEach(function(e){xt.controlsLeft.forEach(function(t){t.removeEventListener(e,at,!1)}),xt.coLine truncated
|
||||
var Reveal=function(){"use strict";function e(e){return Mt||kt?(window.addEventListener("load",h,!1),c(bt,e),n(),r(),void 0):(document.body.setAttribute("class","no-transforms"),void 0)}function t(){if(Tt.theme=document.querySelector("#theme"),Tt.wrapper=document.querySelector(".reveal"),Tt.slides=document.querySelector(".reveal .slides"),!Tt.wrapper.querySelector(".progress")){var e=document.createElement("div");e.classList.add("progress"),e.innerHTML="<span></span>",Tt.wrapper.appendChild(e)}if(!Tt.wrapper.querySelector(".controls")){var t=document.createElement("aside");t.classList.add("controls"),t.innerHTML='<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>',Tt.wrapper.appendChild(t)}if(!Tt.wrapper.querySelector(".state-background")){var n=document.createElement("div");n.classList.add("state-background"),Tt.wrapper.appendChild(n)}if(!Tt.wrapper.querySelector(".pause-overlay")){var r=document.createElement("div");r.classList.add("pause-overlay"),Tt.wrapper.appendChild(r)}Tt.progress=document.querySelector(".reveal .progress"),Tt.progressbar=document.querySelector(".reveal .progress span"),bt.controls&&(Tt.controls=document.querySelector(".reveal .controls"),Tt.controlsLeft=l(document.querySelectorAll(".navigate-left")),Tt.controlsRight=l(document.querySelectorAll(".navigate-right")),Tt.controlsUp=l(document.querySelectorAll(".navigate-up")),Tt.controlsDown=l(document.querySelectorAll(".navigate-down")),Tt.controlsPrev=l(document.querySelectorAll(".navigate-prev")),Tt.controlsNext=l(document.querySelectorAll(".navigate-next")))}function n(){/iphone|ipod|android/gi.test(navigator.userAgent)&&!/crios/gi.test(navigator.userAgent)&&(window.addEventListener("load",u,!1),window.addEventListener("orientationchange",u,!1))}function r(){function e(){n.length&&head.js.apply(null,n),o()}for(var t=[],n=[],r=0,a=bt.dependencies.length;a>r;r++){var s=bt.dependencies[r];(!s.condition||s.condition())&&(s.async?n.push(s.src):t.push(s.src),"function"==typeof s.callback&&head.ready(s.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],s.callback))}t.length?(head.ready(e),head.js.apply(null,t)):e()}function o(){t(),a(),H(),setTimeout(function(){f("ready",{indexh:St,indexv:At,currentSlide:ht})},1)}function a(e){if(Tt.wrapper.classList.remove(bt.transition),"object"==typeof e&&c(bt,e),kt===!1&&(bt.transition="linear"),Tt.wrapper.classList.add(bt.transition),Tt.wrapper.setAttribute("data-transition-speed",bt.transitionSpeed),Tt.controls&&(Tt.controls.style.display=bt.controls&&Tt.controls?"block":"none"),Tt.progress&&(Tt.progress.style.display=bt.progress&&Tt.progress?"block":"none"),bt.rtl?Tt.wrapper.classList.add("rtl"):Tt.wrapper.classList.remove("rtl"),bt.center?Tt.wrapper.classList.add("center"):Tt.wrapper.classList.remove("center"),bt.mouseWheel?(document.addEventListener("DOMMouseScroll",ot,!1),document.addEventListener("mousewheel",ot,!1)):(document.removeEventListener("DOMMouseScroll",ot,!1),document.removeEventListener("mousewheel",ot,!1)),bt.rollingLinks?v():p(),bt.theme&&Tt.theme){var t=Tt.theme.getAttribute("href"),n=/[^\/]*?(?=\.css)/,r=t.match(n)[0];bt.theme!==r&&(t=t.replace(n,bt.theme),Tt.theme.setAttribute("href",t))}P()}function s(){Yt=!0,window.addEventListener("hashchange",ft,!1),window.addEventListener("resize",vt,!1),bt.touch&&(Tt.wrapper.addEventListener("touchstart",G,!1),Tt.wrapper.addEventListener("touchmove",J,!1),Tt.wrapper.addEventListener("touchend",et,!1),window.navigator.msPointerEnabled&&(Tt.wrapper.addEventListener("MSPointerDown",tt,!1),Tt.wrapper.addEventListener("MSPointerMove",nt,!1),Tt.wrapper.addEventListener("MSPointerUp",rt,!1))),bt.keyboard&&document.addEventListener("keydown",B,!1),bt.progress&&Tt.progress&&Tt.progress.addEventListener("click",at,!1),bt.controls&&Tt.controls&&["touchstart","click"].forEach(function(e){Tt.controlsLeft.forEach(function(t){t.addEventListener(e,st,!1)}),Tt.controlsRight.forEach(function(t){t.addEventListener(e,it,!1)}),Tt.controlsUp.forEach(function(t){t.addEventListener(e,ct,!1)}),Tt.controlsDown.forEach(function(t){t.addEventListener(e,lt,!1)}),Tt.controlsPrev.forEach(function(t){t.addEventListener(e,dt,!1)}),Tt.controlsNext.forEach(function(t){t.addEventListener(e,ut,!1)})})}function i(){Yt=!1,document.removeEventListener("keydown",B,!1),window.removeEventListener("hashchange",ft,!1),window.removeEventListener("resize",vt,!1),Tt.wrapper.removeEventListener("touchstart",G,!1),Tt.wrapper.removeEventListener("touchmove",J,!1),Tt.wrapper.removeEventListener("touchend",et,!1),window.navigator.msPointerEnabled&&(Tt.wrapper.removeEventListener("MSPointerDown",tt,!1),Tt.wrapper.removeEventListener("MSPointerMove",nt,!1),Tt.wrapper.removeEventListener("MSPointerUp",rt,!1)),bt.progress&&Tt.progress&&Tt.progress.removeEventListener("click",at,!1),bt.controls&&Tt.controls&&["touchstart","click"].forEach(function(e){Tt.controlsLeft.forEach(function(t){t.removeEventListener(e,st,!1)}),Tt.Line truncated
|
||||
Reference in new issue
Block a user