jquery waypoints
- Started
- Last post
- 16 Responses
- dbloc
can't seem to get this to work...has anyone had any success with it?
- dbloc0
I want to do a scrollTo() with a next and back button, so I need to know where the user is if they scroll manually.
- Explored github's documentation? https://github.com/i…ideaist
- Can you not eliminate the manual scroll option if the elements are fixed?ideaist
- not sure, kinda new to all thisdbloc
- dbloc0
any other options for horizontal scroll?
- dbloc0
scroll from one div to the next, allowing for the user to use scrollbar also
- ukit20
This seems to work...where are you getting stuck?
- BabySnakes0
A quick dirty way might be to make an array of all the divs' id and use that to choose which element to select when using next or back.Though I don't know fully what you are trying to do.
- dbloc0
so I have 5 divs right next to each other. They are each a section of the website. I need a next and back button to go between the sections. This also needs to know where you are in case you move the scrollbar.
- monNom0
^ this what you're looking for
To expand on my earlier post, you'll need a cursor variable to hold the current target index, an array of elements representing the HTML elements you want to scroll too, and something like jquery to take care of the scroll animation..
//pseudocode:
cursor = 0;
elements = document.getElementsByClassName...next button increments cursor and scrollTo( elements[cursor] )
prev button decrements cursor and scrollTo(...window.onscroll = function(){
get the scroll position
divide by element width
set cursor to the new value
}
- dbloc0
I found this, but it uses the scrollTop and that only works vertically.
- dbloc0
http://www.web designer wall.com/demo/scrollto-demo/
- qbn wouldn't let me post the address. take the spaces outdbloc
- ya, where is the code for this, should be able to just change to scrollLeft()BabySnakes
- tried thatdbloc
- dbloc0
so for those that have used waypoints:
I am loading jquery
loading waypoints.jsin document ready, registering div
$('#section1').waypoint();now I should be able to use this and have it alert when I get to it right?
$('#section1').waypoint(function... {
alert('You have scrolled to an entry.');
});- seems so basic, but that's not even working for me...I have to be missing somethingdbloc
- BabySnakes0
Check your email...lucky I have noting to do today at work. :D
- ha haa. thanks!dbloc
- did you send it to my email listed here...hasn't come in.dbloc
- ya i did...hmmBabySnakes
- dbloc0
Snakes you are the Man!
- 3030
@dbloc - there is a nice plugin called inview
https://github.com/protonet/jque…