UPDATE
created some minimal / experimental jQuery plugin: https://gist.github.com/3177804
you can use it like this: http://jsfiddle.net/7q3Zu/2/
download and enable the plugin https://raw.github.com/gist/3177804/556074672de8f200327d83f0146d98533c437ac3/jquery.magnetic.js then call it like this:
$(function() { $('.container').magnetic({
atm is just an experiment without a guarantee of operation in any browser
(so feel free to grasp the essence and improve it :)
As mentioned in the comments, you can do this using Javascript.
Here is an example using jQuery :
http://jsfiddle.net/7q3Zu/
HTML
<div class="container"> <div class="object"></div> </div>
Js
$(function() { var obj = $('.object'); $(document).on('scroll', function() { var offset = $(this).scrollLeft()
CSS
.container{ width: 4000px; padding: 20px; margin: 20px; border: 1px solid #ccc; height: 400px; position: relative; } .object{ position: absolute; height: 400px; width :100px; background: red; left: 200px; }
Max girkens
source share