Reputation: 37
im trying to do this i just cant figure out how to any ideas?
Dont pay attention to the parallax just wanna know how to scale the image while im scrolling(if the scroll goes up make the image smaller and when it goes down bigger)
www.smartusa.com
Upvotes: 3
Views: 6063
Reputation: 154828
Using the scroll position requires JavaScript, if I'm not mistaken.
Just execute a piece of code on scrolling that sets the image size: http://jsfiddle.net/TwLuE/.
$(window).on("scroll", function() {
var s = Math.min(400, $(document).scrollTop()) + 100;
$("img").width(s).height(s);
});
Upvotes: 1
Reputation: 12004
you can use scrollorama to set up positions and configure when the different sizes should be shown.
http://johnpolacek.github.com/scrollorama/
Upvotes: 1