Slide div horizontally with easing

Eno Bassey picture Eno Bassey · Nov 14, 2011 · Viewed 14.2k times · Source

I am looking to achieve a hide/show div where on mouse enter the div is shown but in a sliding left to right manner with easing.

Also i need the page to focus on the new div that just slided out / made visible.

Here is my script.

Any ideas on what i need to add?

<script>$("#box0").mouseenter(function () {
    $("#lSection2").show('slide').delay(5000); 
    $("#boxContent0").slideDown(3000);
    $("#boxContent0").focus();

});

$('#boxContent0').mouseleave(function() {
    $("#boxContent0").fadeOut(1000);     
    $("#lSection2").fadeOut(1000);
});</script>

 <div class="AdBox" id="box0">mouse over or click to view details</div>



 <div id="lSection2" style="display:none;"><div id="boxContent0"
 style="display:none;"  class="boxContent">
     <div align="left" style="">Win Big<br />
 - Ipad<br />
 - Holiday<br />
 - 1 Year Spa Treatments</div>
     <div></div>

Answer

AlienWebguy picture AlienWebguy · Nov 14, 2011
$(element).show('slide', { direction: 'left' }, 1000);
$(element).hide('slide', { direction: 'left' }, 1000);

http://docs.jquery.com/UI/Effects/Slide