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

Start scrolling at a given point only #13

Open
celined opened this issue Aug 18, 2014 · 6 comments
Open

Start scrolling at a given point only #13

celined opened this issue Aug 18, 2014 · 6 comments

Comments

@celined
Copy link

celined commented Aug 18, 2014

Hello,
Thanks for the great plugin. I am using it for this site http://mons-en-montois.fr
I was wondering if there is any way to start the horizontal scrolling only at a given point. In this case, I am trying to have the scrolling start after the horizontal content (home panel) is all gone. Hope that makes sense.

Any help would be greatly appreciated, thanks!

@pixxelfactory
Copy link
Owner

Hi, unfortunately i cannot open your website, the loading icon keeps spinning on and on.
Server down? ;-)

@celined
Copy link
Author

celined commented Aug 19, 2014

Hi sorry about that, should be working now!
If not, is there a way I can send through some files (new to Github eheh)?
I was also wondering, is there a way to slow the scrolling speed down?

Thanks!

@pixxelfactory
Copy link
Owner

Hi, i don't think you can send files through Gh,
as for the issue you have: You cannot make it start scrolling at a certain position without rewriting core-parts of the plugin, but i found a little fix for your case, that would be a solution for both your problems: Simply change the height to a higher value, so the page scrolls slower and the photo-cards appear later.
Also: When clicking the menus, do not scroll horizontally, but make the window scroll vertically, so that the scrolling position is also updated, i rewrote your code to match those things.
Hope that helps.

Cheers
pixxelfactory

jQuery(document).ready(function ($) {
    var height = 9000;

    $.jInvertScroll(['.scroll'], {
        height: height
    });

    $('.navigation').find('a').on('click', function(e) {
        e.preventDefault();

        $('.navigation').find('a').removeClass('active');
        $(this).addClass('active');

        var slide = $(this).data('slide');
        var slidePos = $('#'+slide).position().left;

        var percent = slidePos / $('#postcards').width() * 100;

        $('html,body').animate({
            scrollTop: height / 100 * percent
        });
    });
});

@celined
Copy link
Author

celined commented Aug 19, 2014

Wow thanks so much for your help, this works wonders :)
Just a quick question though: with the new code you've provided, the menu items do not scroll at the exact point where they should when clicked. Can you point me towards what I should do to fix this?

Thanks again!

@pixxelfactory
Copy link
Owner

Hmmm... i tried a little bit to mess with the divs you have,
i guess the problem resides within the ordering and positioning of the single divs.
I think it would be easier to create a transparent div, containing the anchors you want to link to, and position them manually, like stated here (obviously filling in your own positions).
Let me know if this helped you!

Regards
pixxelfactory

@sakshamsaxena
Copy link

I believe we can skip fiddling with the core, and rather define the initial thing ("home panel") like you want to and make it's height equal to the availHeight. Then simply mention the subsequent content (ONLY) in the plugin's selector and only that will horizontally scroll.
I haven't tried it but I think this makes sense.

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

3 participants