SHOW:
|
|
- or go back to the newest paste.
1 | - | <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> |
1 | + | $(window).scroll(function() { |
2 | - | <script> |
2 | + | if ($(window).scrollTop() >= 1) { |
3 | - | $(window).scroll(function() { |
3 | + | $("#test").addClass("scrolled"); |
4 | - | if ($(window).scrollTop() >= 1) { |
4 | + | } |
5 | - | $("#test").addClass("scrolled"); |
5 | + | else { // wenn oben nicht zutrifft, dann: |
6 | - | } |
6 | + | $("#test").removeClass("scrolled"); // entferne Klasse wieder |
7 | - | }); |
7 | + | } |
8 | - | </script> |
8 | + | }); |