can someone help me in simplifying the following piece of code.
I suggest there is some e.data stuff to do, but I don’t know if it is possible if there is changing variables, too, in it.
function suggestImage()
{
var ww = $(window).width();
var newiw = (ww/100)*94;
$('#arrowField') .css('width','6%');
$('#arrowIn') .animate({'left': '4%','margin-left': '1px'}, 950, 'easeOutBack');
$("#imageIn") .animate({'width': '6%'}, 950, 'easeOutBack');
$("#shadow") .animate({'left': '6%'}, 950, 'easeOutBack');
if (newiw < 2000)
{
$("#character_lab") .animate({'margin-left': '4%','width': newiw + 'px','height': (newiw/4) + 'px', 'margin-top': -(newiw/8) + 'px'}, 950, 'easeOutBack');
}
else
{
$("#character_lab") .animate({'margin-left': '4%','width': newiw + 'px','height': '500px', 'margin-top': '-250px'}, 950, 'easeOutBack');
}
$("#letters") .animate({'margin-left': '2%'}, 950, 'easeOutBack');
$("#name") .animate({'margin-left': '3%'}, 950, 'easeOutBack');
};
function letImage()
{
var ww = $(window).width();
var newiw = ww;
$('#arrowField') .css('width','2%');
$('#arrowIn') .animate({'left': '0%','margin-left': '5px'}, 950, 'easeInBack');
$("#imageIn") .animate({'width': '0%'}, 950, 'easeInBack');
$("#shadow") .animate({'left': '0%'}, 950, 'easeInBack');
if (newiw < 2000)
{
$("#character_lab") .animate({'margin-left': '0%','width': newiw + 'px','height': (newiw/4) + 'px', 'margin-top': -(newiw/8) + 'px'}, 950, 'easeInBack');
}
else
{
$("#character_lab") .animate({'margin-left': '0%','width': newiw + 'px','height': '500px', 'margin-top': '-250px'}, 950, 'easeInBack');
}
$("#letters") .animate({'margin-left': '0%'}, 950, 'easeInBack');
$("#name") .animate({'margin-left': '0%'}, 950, 'easeInBack');
};
function fullImage()
{
var ww = $(window).width();
var newiw = (ww/100)*76;
$("#imageIn") .animate({'width': '24%'}, 1900, 'easeOutBack');
$("#shadow") .animate({'left': '24%'}, 1900, 'easeOutBack');
if (newiw < 2000)
{
$("#character_lab") .animate({'margin-left': '22%','width': newiw + 'px','height': (newiw/4) + 'px', 'margin-top': -(newiw/8) + 'px'}, 1900, 'easeOutBack');
}
else
{
$("#character_lab") .animate({'margin-left': '22%','width': newiw + 'px','height': '500px', 'margin-top': '-250px'}, 1900, 'easeOutBack');
}
$("#letters") .animate({'margin-left': '24%',}, 1900, 'easeOutBack');
$("#name") .animate({'margin-left': '21%'}, 1900, 'easeOutBack');
$("#text") .animate({'margin-left': '36%', 'margin-right': '19%'}, 1900, 'easeOutBack');
imageout = 1;
}
function removeImage()
{
var ww = $(window).width();
var newiw = ww;
$("#imageIn") .animate({'width': '0%'}, 1900, 'easeOutBack');
$("#shadow") .animate({'left': '0%'}, 1900, 'easeOutBack');
if (newiw < 2000)
{
$("#character_lab") .animate({'margin-left': '0%','width': newiw + 'px','height': (newiw/4) + 'px', 'margin-top': -(newiw/8) + 'px'}, 1900, 'easeOutBack');
}
else
{
$("#character_lab") .animate({'margin-left': '0%','width': newiw + 'px','height': '500px', 'margin-top': '-250px'}, 1900, 'easeOutBack');
}
$("#letters") .animate({'margin-left': '0%'}, 1900, 'easeOutBack');
$("#name") .animate({'margin-left': '0%'}, 1900, 'easeOutBack');
$("#text") .animate({'margin-left': '19%'}, 1900, 'easeOutBack');
imageout = 0;
}