1

I'm giving some elements on my page a slower scroll effect. This looks great for elements that appear on top of the page, but for the elements down the page, not so much. I'm trying to figure out a way to have the custom scroll speed trigger once a certain element has entered the viewport. Right now I have elements from the bottom of the page completely out of place due to the custom scroll being triggered as soon as the page loads.

Here's the code for my scroll speed:

$('element_name').css({
            'transform' : 'translate(0px, '+ wScroll /2 +'%)'
        });
  • [This answer](http://stackoverflow.com/a/7557433/2341603) may help you find out whether an element is in the current viewport. Just plug your CSS code into this. – Obsidian Age Mar 19 '17 at 19:47
  • @ObsidianAge thanks, but that's not quite what I'm asking for. What I want to know is if there's a way I can trigger the custom scroll command when an element enter the view port. –  Mar 19 '17 at 20:24
  • That's precisely what the answer I linked to does. It triggers code whenever an element enters the viewport. See 'How to use', and enter your code in `/* your code go here */`... – Obsidian Age Mar 19 '17 at 21:10

0 Answers0