Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LInking to individual slides. #170

Open
lilhudi opened this issue Apr 15, 2014 · 3 comments
Open

LInking to individual slides. #170

lilhudi opened this issue Apr 15, 2014 · 3 comments

Comments

@lilhudi
Copy link

lilhudi commented Apr 15, 2014

So i love this plugin.

I had to link to specific slides. I know the html doc has this functionality but i could not make it work. The code that i came up with that worked was this.


function GetURLParameter(sParam)
    {
        var sPageURL = window.location.search.substring(1);
        var sURLVariables = sPageURL.split('&');
        for (var i = 0; i < sURLVariables.length; i++) 
        {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
        {
            return sParameterName[1];
        }
        }
        return null;
    }



        jQuery(function($){

            var slideNum = GetURLParameter("num");
            var num = 1;
            if(slideNum!=null){
                    if(num > 0) num = slideNum;
            }

the code that takes you to the slide looks like this

http://www.yoururl/name.html?num=2
the .html?num1 is the important part.

@eeeBs
Copy link

eeeBs commented Jun 14, 2014

Wonder what changes would need to be made to make this work on wordpress sites. Specifically the main page.

@lilhudi
Copy link
Author

lilhudi commented Jun 16, 2014

Humm sorry i dont know. Have you tried it? any links and i could take a look.

@eeeBs
Copy link

eeeBs commented Jun 17, 2014

I found a way lol, it's not pretty thought:

jQuery(function($){ 

var url = window.location.hash ;
var startslide = 1;

if ( url.indexOf("#anchor") !=-1) {
   startslide = 1;
} else if ( url.indexOf("#anchor") !=-1) {
   startslide = 2;
} else if ( url.indexOf("#anchor") !=-1) {
   startslide = 3;
} else if ( url.indexOf("#anchor") !=-1) {
   startslide = 4;
} else if ( url.indexOf("#anchor") !=-1) {
   startslide = 5;
} else if ( url.indexOf("#anchor") !=-1) {
   startslide = 6;
}

For the top part, this will look for an anchor in any external link and load up the correct slide. Replace #anchor and startslides with the correct stuff.

Then to get the WP Nav links to work ON PAGE, I added:

$( '.menu-item-36 a' ).click( function() {
       api.goTo(1);
       vars.is_paused = 1;
    });

$( '.menu-item-28 a' ).click( function() {
        api.goTo(2);
        vars.is_paused = 1;
    });

$( '.menu-item-29 a' ).click( function() {
        api.goTo(3);
        vars.is_paused = 1;
    });

$( '.menu-item-30 a' ).click( function() {
        api.goTo(4);
        vars.is_paused = 1;
    });

$( '.menu-item-53 a' ).click( function() {
        api.goTo(5);
        vars.is_paused = 1;
    });

$( '.menu-item-43 a' ).click( function() {
        api.goTo(6);
        vars.is_paused = 1;
    });

Obviously the lazy way instead of getting the WP Menu links dynamically, but it works, and I have a deadline lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants