hakimel / reveal.js

The HTML Presentation Framework
https://revealjs.com
MIT License
67.62k stars 16.63k forks source link

missing navigation option: skip to next slide #1921

Open robinparmar opened 7 years ago

robinparmar commented 7 years ago

It appears that there is no navigation option that skips the remaining fragments in a section and immediately loads the next slide. This is useful in two cases:

Here is an inventory of the four available navigation options, in the forwards direction. (BTW, it would also be helpful if these were explained in this manner in the documentation.)

The "next" and "down" options are certainly useful. I presume that "nextFragment" is included for programmatic reasons. However, it is difficult to see a use case for "right". This can be re-defined as follows.

That is the functionality I am looking for. And also similar for "left".

robinparmar commented 7 years ago

Here's the code. Sorry, I am a newbie with github and have no idea how to do anything.

Hope this helps someone nonetheless. This is essentially a simplified version of the existing code, less the checks for fragments.

function navigateLeft() {
    if( availableRoutes().left ) {
        // reverse for RTL
        if( config.rtl ) {
            slide( indexh + 1 );
        } else {
            slide( indexh - 1 );
        }
    }
}

function navigateRight() {
    if( availableRoutes().right ) {
        // reverse for RTL
        if( config.rtl ) {
            slide( indexh - 1 );
        } else {
            slide( indexh + 1 );
        }
    }
}
robinparmar commented 7 years ago

This is not quite correct either, because cursoring "backwards" ("left" in normal handedness) should position you at the TOP of the previous slide. Here it takes you to the last element of that slide.