Div that moves as you scroll
- Started
- Last post
- 6 Responses
- BusterBoy
http://www.darenberg.com.au/buy-…
Looking for any code samples to do the cart contents box that moves as you scroll.
I have managed to do something similar but mine struggles with centred content. My content area is centred, and my div is on the right side of the content, very much like the example above.
Any help appreciated.
- ismith0
CSS
.divclass { position: fixed; }?
- acescence0
the jquery that does it on the page you linked is at the bottom if you view source..
$(document).ready(function() {
cartYLoc = parseInt($(cartID).css("top").su...
$(window).scroll(function() {
var offset = cartYLoc;
if(cartYLoc - $(document).scrollTop() < 0) {
offset = $(document).scrollTop();
}
if (offset != 500) offset = offset - bottom_offset;
$(cartID).animate({top:offset...});
});
- Hall0
i find it annoying.
obviously has its place though.
- GeorgesII0
Wanted to know something similar,
How would you use jquery to do something similar to mimeartist's site,
I have two flash site that are loaded one next to the other and I want to be able to move the window from one site to another,
possible?
- neverblink0
set window overflow to hidden
on button call jQuery script
animate body left margin to -1*(body.width)and back
on button call jQuery script
animate body left margin to 0- thank you, will try it right nowGeorgesII
- this is proto-code btw not real jquery - just so you don't blame me it doesn't workneverblink
- nah, I looked in the docs,
thanks for showing the wayGeorgesII
- neverblink0
in above script, change body.width to the width of the flash movie.. otherwise it will scroll both movies out of frame