to clearify
the script works with show hide and fade in out but not the move part.
the script is as follows.`
$(document).ready(function() { //Flyttar menyn till mitten
menu_pos = document.documentElement.clientWidth / 2 – $(‘#menu’) .width()/2;
//alert (menu_pos);
//alert ($(‘#menu’) .width());
$(‘#div1′).stop().animate({top:’0px’, left:’0px’,’width’:’120px’},500);
$(‘#div2′).stop().animate({top:’0px’, left:’0px’,’width’:’120px’},500);
$(‘#div3′).stop().animate({top:’0px’, left:’0px’,’width’:’120px’},500);
$(‘#div4′).stop().animate({top:’0px’, left:’0px’,’width’:’120px’},500,function() { menu_pos = document.documentElement.clientWidth / 2 – $(‘#menu’) .width()/2 + 25; $(‘#menu’).animate({left: +menu_pos},500);});
});
function animeraDiv(obj){
div_pos = +menu_pos – $(‘#’+obj) .width();
if(($(‘#div1’).css(‘top’)>’0′)||($(‘#div2’).css(‘top’)>’0′)||($(‘#div3’).css(‘top’)>’0′)||($(‘#div4’).css(‘top’)>’0′)){
//$(‘#menu’).animate({bottom:’0px’},200); //S?tter meny divven i r?tt niv?
$(‘#div1′).stop().animate({top:’0px’,left:’0px’,’width’:’120px’},500);
$(‘#div2′).stop().animate({top:’0px’,left:’0px’,’width’:’120px’},500);
$(‘#div3′).stop().animate({top:’0px’,left:’0px’,’width’:’120px’},500);
$(‘#div4′).stop().animate({top:’0px’,left:’0px’,’width’:’120px’},500,function() { menu_pos = document.documentElement.clientWidth / 2 – $(‘#menu’) .width()/2 + 25; $(‘#menu’).animate({left: +menu_pos},500);});
$(‘#menu p’).fadeOut(400);
$(‘#menu span’).fadeIn(500);
}
if($(‘#’+obj).css(‘top’)<‘100’){
$(‘#menu’).stop().animate({‘top’:’0px’},200);//S?tter meny divven i r?tt niv?
$(‘#’+obj).stop().animate({‘top’:’100px’,’left’:’0px’,’width’:’300px’},500,function() { menu_pos = document.documentElement.clientWidth / 2 – $(‘#menu’) .width()/2 + 25; $(‘#menu’).animate({left: +menu_pos},500);});
$(‘#’+obj+’ span’).fadeOut(500);
$(‘#’+obj+’ p’).fadeIn(1000);
//$(‘#’+obj’+’text).stop().animate({‘top’:’100px’,’left’:’0px’,’width’:’300px’},500);
} else {
$(‘#menu’).stop().animate({‘top’:’0px’},200); //S?tter meny divven i r?tt niv?
$(‘#’+obj).stop().animate({‘top’:’0px’, ‘left’:’0px’,’width’:’120px’},500,function() { menu_pos = document.documentElement.clientWidth / 2 – $(‘#menu’) .width()/2 + 25; $(‘#menu’).animate({left: +menu_pos},500);});
$(‘#’+obj+’ p’).fadeOut(400);
$(‘#’+obj+’ span’).fadeIn(500);
}
}