1

bouncydiv.js

783 views

Here is a nifty little javascript script using Damped Harmonic Oscillations. It allows you to have a div on your page bounce around as the user scrolls, much like the sidebar ads on this website.

This script makes a div scroll down with the screen. Its most useful for advertising blocks that you want to always be in front of the user. To useĀ  this script, set the variable ’scrollerId’ to the id of the div you want to be bouncy. Remember to also set the div’s style position to
“position:relative;” as this will allow the div to move. Then simply add the javascript file to your webpage.

Feel free to use this as you see fit. Credit would be appreciated or at least just a link to dejapong.com if you can find it in your heart to do so.

Have fun,

Dejapong

Demo    |    Source

One Response to “bouncydiv.js”

  1. dawn says:

    nifty….I understood very little of the explanation, but I guessed its use correctly before reading it (keeping particular ads at the front of attention) so I;m proud of myself for that. You’ve passed my brains up long ago!

Leave a Reply