Buff
Buff

Reputation: 37

How can i scale an image with (moz/webkit/etc) while scrolling

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

Answers (2)

pimvdb
pimvdb

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

Mike Axiak
Mike Axiak

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

Related Questions