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

noAnchors active state #106

Closed
fourroses666 opened this issue Sep 26, 2016 · 8 comments
Closed

noAnchors active state #106

fourroses666 opened this issue Sep 26, 2016 · 8 comments

Comments

@fourroses666
Copy link

I would like to hide the anchors, but do need the menu.
So I came to the idea to use a function. (see below)
But then the active state doesn't work anymore.
Is there a better solution to hide the anchors, use the menu and keep the active states?

<script>
    function one() {$.fn.pagepiling.moveTo(1);}
    function two() {$.fn.pagepiling.moveTo(2);}
    function three() {$.fn.pagepiling.moveTo(3);}
</script>

<div class="menu">  
    <div class="active"><a href="javascript:void()" onclick="one()">Wie</a></div>
    <div><a href="javascript:void()" onclick="two()">Wie extra</a></div>
    <div><a href="javascript:void()" onclick="three()">Wat</a></div>
</div> 
@alvarotrigo
Copy link
Owner

alvarotrigo commented Sep 26, 2016

But then the active state doesn't work anymore.

I don't see why it shouldn't. Please provide an isolated reproduction in jsfiddle or codepen.

@fourroses666
Copy link
Author

Made a fiddle but the custom functions are not working there.
One my demo site they are, not sure why..

https://jsfiddle.net/fourroses666/byhn9cza/

@alvarotrigo
Copy link
Owner

@fourroses666
Copy link
Author

fourroses666 commented Sep 26, 2016

Thanks, had some issues with base href.

The menu buttons still doesn't get an active class when clicked.
This could be fixed by adding some script to the function so I think I will be fine.

@fourroses666
Copy link
Author

https://jsfiddle.net/fourroses666/byhn9cza/3/

It now works when you click on an other button, but when scrolling the class is not added. :(

@alvarotrigo
Copy link
Owner

The menu buttons still doesn't get an active class when clicked.

Add it yourself just before calling moveTo.

@alvarotrigo
Copy link
Owner

It now works when you click on an other button, but when scrolling the class is not added. :(

Add it yourself using the plugin callbacks such as onLeave.

@fourroses666
Copy link
Author

fourroses666 commented Sep 26, 2016

Do you have an example? its to hard for me to understand.

Based on this I don't know what to do.

    $('#pagepiling').pagepiling({
        onLeave: function(index, nextIndex, direction){
            //after leaving section 2
            if(index == 2 && direction =='down'){
                alert("Going to section 3!");
            }

            else if(index == 2 && direction == 'up'){
                alert("Going to section 1!");
            }
        }
    });

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

No branches or pull requests

2 participants