How to detect horizontal scroll position relative to anchors in Javascript?
-
Ok, I'm building a horizontal scroll website for a photographer. We have some really nice wireframes done and I'm looking to create a neat effect where it highlights the specific photo you that is on the left of the screen at all times or more specifically set the transparency to 40% on all other photos. So I know I can add anchors to each photo so I can use that to have a click to next option but what if the user uses the scroll bar manually, is there any way for me to detect the position relative to the each photo. Bare in mind to make this even more awkward even though each photo is the same hight they can have different widths. I'm thinking if there was a way to get the position of each anchor tag then I could detect the current position against it and use some maths to figure out which one is in focus.
-
Answer:
You can find the position of any element by grabbing its offset. http://www.quirksmode.org/js/findpos.html
Todd Iceton at Quora Visit the source
Related Q & A:
- How To Detect Online Facebook User?Best solution by Stack Overflow
- How To Detect Adblock?Best solution by Stack Overflow
- How To Detect Who Is Online In Facebook?Best solution by Stack Overflow
- How To Detect Invisible Users On Yahoo?Best solution by Yahoo! Answers
- How do I calculate a xyz-position of a GPS-position relative to an other GPS-position?Best solution by Geographic Information Systems
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.