Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 314
  • Last Modified:

jQuery Waypoints

Hello Experts,

I am trying to do, for the first time, something very simple using the jQuery Waypoints plugin.
I am changing the "header" classes depending on the window scroll offset.
Here is an online example: http://codepen.io/ilan-lavi/pen/scwHb

What happens is when you resize the screen (viewport) the style is gone. I was trying to fix this using the "refresh" method as in the Waypoints documentation but no luck. Please see that page link above and re-size the window.

Any help would be appreciated!
0
Refael
Asked:
Refael
  • 2
  • 2
1 Solution
 
RobOwner (Aidellio)Commented:
I believe you've got the waypoint on the wrong element.  Given it's the section that's scrolling, not the header, it should be initialised on that:

http://jsbin.com/sebufu/1/
0
 
RefaelAuthor Commented:
Hi Rob Jurd, Thank you.

Shouldn't you apply the Waypoints on the element it self? What you are doing here is applying it to an element after the one you want to animate. What if i need to apply the same on the footer, should i then apply it to an element before it?
0
 
RobOwner (Aidellio)Commented:
Yes that's exactly what you'd do because it's the element before it that you would be scrolling.
A little bit counter intuitive isn't it
0
 
RefaelAuthor Commented:
Rob Jurd Thank you!

The idea of applying the waypoints to an element before/after the element you trigger is indeed working yet in all the examples / tutorials i saw they always applying it directly on the element it self. Anyway if it works then it works :-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now