jquery - SlideToggle div over content -
i have 2 divs. in each div have content , div thats default hidden , relative positioned on top of content. when hover on div want hidden div slide up. tried isn't working me.
code.. ill show part of it, since both divs same. html:
<div class="youtube"> <h1> youtube </h1> <span></span> <div class="yt-desc"> <p> pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. </p> </div><!-- // .yt-desc --> </div> <!-- // .youtube --> css:
heres css one,the .forums same. took out unneeded css.
.youtube, .forums { background: #3c3c3c url(../images/boxes-bg.jpg) repeat-x; float: left; position: relative; z-index: -1; width: 260px; } .youtube h1, .forums h1 { text-indent: -9999px; margin: 26px auto; } .youtube { margin: 0 216px 0 0; } .youtube h1 { background: url(../images/yt-header.png) no-repeat; height: 36px; margin: 21px; auto; width: 212px; } .youtube span { background: url(../images/icons/youtube.png) no-repeat; display: block; height: 75px; margin: 26px auto; width: 79px; } .youtube .yt-desc, .forums .forums-desc { position: absolute; top: 94px; left: 0px; padding: 5px; display: none; } yt-desc i'm trying slideup. reason not working.
ive tried.
$(".youtube").hover(function () { $(".yt-desc").slidetoggle("fast"); }); still no luck. can help? :/ heres idea of i'm trying - 
if understand correctly, want this: example
using display: none doesn't render element until "show" it, hiding away element overflow: hidden better.
here nice tutorial on similar effect
didn't solve problem really, hope helps anyway!
edit: code example:
css
.youtube, .forums { background: #3c3c3c url(../images/boxes-bg.jpg) repeat-x; position: relative; width: 260px; overflow: hidden;} .youtube h1, .forums h1 { text-indent: -9999px; margin: 26px auto; } .youtube { margin: 0 216px 0 0; } .youtube h1 { background: url(../images/yt-header.png) no-repeat; height: 36px; margin: 21px; auto; width: 212px; } .youtube span { background: url(../images/icons/youtube.png) no-repeat; display: block; height: 75px; margin: 26px auto; width: 79px; } .youtube .yt-desc, .forums .forums-desc { width: 260px; position: absolute; bottom: -200px; padding: 5px;} jquery
$(".youtube").hover( function(){ $(this).children("div.yt-desc").stop().animate({bottom: 0}, 500); }, function(){ $(this).children("div.yt-desc").stop().animate({bottom: -20}, 500); });
Comments
Post a Comment