You can do using the library greensock. Very good for animation in js.
She’s used that way:
HTML
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="cont1">
<a href="#" id="back">BACK</a>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veritatis voluptate molestiae velit eius ullam recusandae aspernatur quae perspiciatis beatae facilis consequuntur soluta! Ipsam omnis impedit porro numquam neque aperiam atque.</p></div>
<div class="cont2">
<a href="#" id="more">MORE</a>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam animi officia consequatur quidem consequuntur? Hic similique veritatis porro. Cum quibusdam recusandae fuga beatae saepe deleniti iure sequi eveniet numquam veniam.</p></div>
</body>
</html>
CSS
.cont1{
background-color: #ccc;
padding: 10px;
width: 300px;
}
.cont2{
top: 0;
width: 100%;
background-color: #fff;
position: absolute;
height: 100%;
padding: 30px;
}
Javascript com Greensock
$("#more").click(function(){
TweenMax.to($(".cont2"), 1, {left: 300});
});
$("#back").click(function(){
TweenMax.to($(".cont2"), 1, {left: 0});
});
I made this small example for you to see how it works. You can see the example here.
I’ll explain a little better than I have today. I have a call
menu
, when I click on it, another div calledmenufixo
that’s likedisplay:none
staysdisplay:block
. Then blz, so I have to change my extrusion, right? My code http://jsfiddle.net/felipestoker/mHv7K/– Felipe Viero Goulart
So Felipe, according to what you sent I think it won’t change much not... In this case you just sent me I just changed the positioning of the right of your css, and added the greensock library to work with the effect. I made a little transition from right to left. If it’s a little different what you’re going to do the structure won’t even change mt no, what changes will be more in css, even then it would be little thing. , see how it looks: http://jsfiddle.net/mHv7K/3/
– Guilherme Louro
I managed to do it the way I wanted, excellent plugin. : D Just a doubt, I’m using it for when I click
menu
He plays a whole div I got right toright:300px
, only that some elements are disappearing, it would be better to work with the width of the screen instead, know how to capture the screen size so that elements do not disappear?– Felipe Viero Goulart
catch screen size in javascript is window.innerWidth; e window.innerheight;
– Guilherme Louro
I’m using it like this: http://jsfiddle.net/felipestoker/eY9b3/ what happens instead of me using
right:300px
I think the ideal would be to touch the total width of the screen, not to hide any item, the process would then be?TweenMax.to($(".fundo1"), 0.5, {'window.innerWidth'-300px: "300px"});

or something like that?– Felipe Viero Goulart
I don’t understand very well what you want to do when you say "move the total width of the screen"... do you want to put the div to the width of the current screen? if that’s what your div has to have in css width: 100% , that’s it?
– Guilherme Louro
What happens is that the div
fundo1
by default has 100% when I click on the itemmenu
, opens a direct fixed menu that holds the divfundo1
to the left, when he pushes, he’s hiding some items, so I want the divfundo1
just change width, not to hide anything, so I wanted to calculate the total width, I just don’t know how.– Felipe Viero Goulart
Ahhh I think I got it. So your js will have to look something like this: http://jsfiddle.net/eY9b3/1/
– Guilherme Louro
I got it this way:
TweenMax.to($(".fundo1"), 0.5, {width: ($(window).width() -320)});
:P– Felipe Viero Goulart
yes, it ends up being the same,
window.innerWidth
is the same thing as$(window).width()
, but without using jQuery... in case you have put right the-320
remember to change around also in case you change its size in css at some point... in the case of$("#menuFixo").width()
it already takes the size that is set in css– Guilherme Louro
I did, your help with the plugin was essential. Hug! D
– Felipe Viero Goulart