rigor789 / vue-scrollto

Adds a directive that listens for click events and scrolls to elements.
https://vue-scrollto.rigor789.com/
MIT License
2.07k stars 99 forks source link

Scrollto errors inside container #38

Closed nicolasvahidzein closed 7 years ago

nicolasvahidzein commented 7 years ago

Hello Rigor, how are you?

i have not been able to fix the error i see in behavior when i use scrollto in a side bar, going down works fine but i cannot go back up, it stops halfway. Anyway ideas?

rigor789 commented 7 years ago

Hey Nicolas, can you somehow reproduce the problem in a js fiddle, or a demo repository? I don't know what could be wrong, since I have not seen such behavior before

nicolasvahidzein commented 7 years ago

Ok i will try, give me a bit of time i've never used jsfiddle.

nicolasvahidzein commented 7 years ago

https://jsfiddle.net/v54o3n3b/

started, how do i import the module to test it out?

nicolasvahidzein commented 7 years ago

i cleaned it up a bit but i think it did not load all the elements properly still, could you please let me know what is missing?

https://jsfiddle.net/v54o3n3b/2/

rigor789 commented 7 years ago

I have added both vue and vue-scrollto to the scripts in jsfiddle, but there are still a few errors that you should fix. https://jsfiddle.net/v54o3n3b/3/

Edit: I cleaned up the fiddle, and it is working: https://jsfiddle.net/v54o3n3b/5/

nicolasvahidzein commented 7 years ago

there is nothing added to version 3 my friend, maybe is wasn't saved.

nicolasvahidzein commented 7 years ago

I forked it so it's clean, i think i might have made pressed update a few times before your edits that is why they were not showing up.

here is the new one: https://jsfiddle.net/zbfg4dwr/

sorry buddy.

rigor789 commented 7 years ago

Hey, the new fiddle does not have the imported libraries thus has many console errors, Here is a fiddle that has it all working: https://jsfiddle.net/vuzpa24m/

Scrolling works both ways without any issues inside the container.

nicolasvahidzein commented 7 years ago

Thank you Igor, i will study it. Thank you so much!!!

nicolasvahidzein commented 7 years ago

Hello Igor, when i implement it, i get both normal scrollbars and yours superimpossed. I can't for the life of me get rid of them. Any ideas?

rigor789 commented 7 years ago

This plugin does not add custom scrollbars, it just scrolls inside containers, using scrollTop. if you have custom scrollbars, you might want to check if they are implemented differently, they might be incompatible.

nicolasvahidzein commented 7 years ago

My apologies, wrong comment, i was tired this was late at night. I meant to say that despite the example inside my code it does not run properly. It still stops half way through it. On a normal page though it works. It has to do with maybe how my sidebar is displayed, does it have to displayed as a block or something?

rigor789 commented 7 years ago

I really can't tell unless I see it not working :/

nicolasvahidzein commented 7 years ago

How does one share code like this? The vue file is enough with the css? Or the whole project. Youll hate seen my 5000 lines.

rigor789 commented 7 years ago

Can you share a link where I can see it in action? Anything temporary works

nicolasvahidzein commented 7 years ago

I don't know how to export yet. Can i run npm run build and post the rest online? Otherwise i can try to make a video capture. Tell me what you prefer.

nicolasvahidzein commented 7 years ago

https://jsfiddle.net/v54o3n3b/6/

i updated it to look more like it does for me but it still works. I'm confused.

Here is the video: http://www.zeintek.com/TEMP/SANDBOX/MISC/vuejs/scrollto/1-scrollissue/scrolltodemo-1.avi

rigor789 commented 7 years ago

If the scrolling to the top consistently stops in the same spot, regardless of screen size, try adding an offset to the scroll-to options.

nicolasvahidzein commented 7 years ago

Thank you very much buddy, i think the missing height is related to the height of my navbar height somehow. You were an awesome help. I wish you a wonderful week and hang in there.