tags:

views:

103

answers:

1

I am setting up a page with a vector couch on the right and on mouseover it will slide out. My goal is to have my content to the left of the couch slide off to the left of the page.

Would I need to set my elements to absolute to have then slider over? I will probably be using animate() to move the couch out adjusting the right css property.

By default will it slide off to the left?

Any ideas on this, i know how to do something to slide it out, but not sure how to make the content slide off to the left of the page.

Example HTML structure: http://pastie.org/458876

NEW CODE:

$(document).ready(function() {
  $('#slidemarginleft button').click(function() {
 var $marginLefty = $(this).next();
 $marginLefty.animate({
   marginLeft: parseInt($marginLefty.css('marginLeft'),10) == 0 ?
  $marginLefty.outerWidth() :
  0
 });
  });
});

Say i use this code above to move the couch left to right

Thanks,

Ryan

+1  A: 

Yes, the only way to make elements slide off the page is using fixed and/or absolute positioning (outside of simply making the elements larger than the page).

I'm not sure if "it" will fall of the page to the left, because I'm not precisely sure how the containers are setup. I'm sure a number of people will be willing to make better guesses if you were to throw up an example of what the HTML would look like. (use jsbin.com is a good place to setup the example)

altCognito
Thats what i was thinking, but how would I make it coincide with the animate to the left? When I have my hover effect, do I need to manually slide my content to the left out as well as the right?
Coughlin
Let me whip up a quick example for you guys
Coughlin
Just added an example to my original question
Coughlin
Is the couch off the page at the start as well?
altCognito
Yes, it is about 80% off, you will only see the left side of the couch.
Coughlin