javascript - JS accordion and Animation issue -
hi guys need accordion have made in jquery on hover have added specific consecutive animations in mouse out animation go crazy , not follow chronology, sure there issue logic , needs improvements please guide how use .stop() function, highly appreciated!
js
$(document).ready(function () { $(".left").hover( function () { $(".left").animate({ width: "798px" }, 2000, function () { $(".leftimage").animate({ "left": "-260px" }, 1000); $(".left>h2, .left>h3").animate({ "left": "100px", opacity: 0 }, 1000, function () { $(".left>h2").animate({ "left": "180px", "fontsize": "4em", "line-height": "40px", opacity: 1 }, 600, function () { $(".left>h3").animate({ "left": "-140px", opacity: 1 }, 1000); }); }); }); $(".right").animate({ width: "1px" }, 2000); }, function () { $(".left").animate({ width: "400px" }, 1000); $(".right").animate({ width: "400px" }, 1000); $(".leftimage").animate({ "left": "200px" }, 1000, function () { $(".left>h3").animate({ "left": "-30px" }, 600) }); $(".left>h2").animate({ "left": "-60px", "fontsize": "2.4em" }, 600); }); $(".right").hover( function () { $(".right").animate({ width: "798px" }, 2000); $(".left").animate({ width: "1px" }, 2000); }, function () { $(".right").animate({ width: "400px" }, 1000); $(".left").animate({ width: "400px" }, 1000); }); });
html
<div id="wrapper"> <div class="outmost"> <div class="outer"> <div class="left"> <h2>youth</h2> <h3>hi</h3> <img class="leftimage" src="img/yth1.png" /> </div> <div class="right"> <h2>elder</h2> <h3>hello</h3> <img class="rightimage" src="img/old2.png" /> </div> </div> </div> </div>
css
.wrapper { width:900px; margin: 0 auto; padding:0; } .outmost { position: relative; width: 900px; height: 400px; margin: 0 auto; } .outer { position: relative; width: 800px; height: 300px; margin: 0 auto; } .left > h2, .right > h2 { position: relative; font-family: sans-serif; font-weight: lighter; font-style: italic; font-size: 2.4em; top: 16px; } .left > h3, .right > h3 { position: relative; font-family: sans-serif; font-weight: lighter; font-size: 3.4em; top: 100px; padding: 4px 4px; border-radius: 6px; } .left > a, .right > { position: relative; text-decoration: none; font-family: sans-serif; letter-spacing: 1px; font-weight: lighter; font-size: 16px; } .leftimage, .rightimage { bottom: 60px; } .left { position:relative; text-align: center; width: 400px; height: 300px; float: left; overflow: hidden; } .left > h2 { position: relative; right: 60px; } .left > h3 { position: relative; border: 4px solid; width: 52px; margin: 0 auto; right: 40px; } .left > { } .leftimage { position: relative; float: none; display:block; margin: auto; left: 200px; } .right { position:relative; text-align: center; width: 400px; height: 300px; float: right; overflow: hidden; } .right > h2 { position: relative; left: 40px; } .right > h3 { position: relative; border: 4px solid; width: 140px; margin: 0 auto; left: 40px; } .rightimage { position: relative; float: none; display:block; margin: auto; right: 180px; }
Comments
Post a Comment