jquery-effects

JQuery show and hide div on mouse click (animate)

十年热恋 提交于 2019-11-27 07:06:09
This is my HTML code: <div id="showmenu">Click Here</div> <div class="menu" style="display: none;"> <ul> <li>Button1</li> <li>Button2</li> <li>Button3</li> </ul> </div> And I want to show .menu on click on #showmenu sliding from left to right (with animate). On click again on #showmenu or anywhere in site page, .menu will hide (slide back to left). I use JQuery 2.0.3 I've tried this, but it doesn't do what I want. $(document).ready(function() { $('#showmenu').toggle( function() { $('.menu').slideDown("fast"); }, function() { $('.menu').slideUp("fast"); } ); }); That .toggle() method was

jQuery cross-browser “scroll to top”, with animation

烂漫一生 提交于 2019-11-27 05:48:02
问题 Right now I'm using this: $('#go-to-top').each(function(){ $(this).click(function(){ $('html').animate({ scrollTop: 0 }, 'slow'); return true; }); }); which doesn't work in Chrome, and in Opera I get a small flicker: the browser instantly scrolls to the top, then back to the bottom and then it begins to scroll slowly back to top, like it should. Is there a better way to do this? 回答1: You're returning true from the click function, so it won't prevent the default browser behaviour (i.e.

Does jQuery have a plugin to display a “message bar” like the Twitter “wrong password” bar at the top of screen?

非 Y 不嫁゛ 提交于 2019-11-26 18:16:35
问题 Twitter will pop down a message bar at the top of the screen say "Wrong password" and after 10 seconds, it will slide up and disappear. Chrome also shows "Do you want to save the password" message box using such a way. Does jQuery have a plug in to do that already? Does it also work in IE 6? Because usually, the display of relative to the viewport (using position: fixed ) will not work on IE 6. thanks. Update: thanks for the nice solutions -- I deliberately wanted it to work (1) even when the

JQuery show and hide div on mouse click (animate)

与世无争的帅哥 提交于 2019-11-26 13:02:43
问题 This is my HTML code: <div id=\"showmenu\">Click Here</div> <div class=\"menu\" style=\"display: none;\"> <ul> <li>Button1</li> <li>Button2</li> <li>Button3</li> </ul> </div> And I want to show .menu on click on #showmenu sliding from left to right (with animate). On click again on #showmenu or anywhere in site page, .menu will hide (slide back to left). I use JQuery 2.0.3 I\'ve tried this, but it doesn\'t do what I want. $(document).ready(function() { $(\'#showmenu\').toggle( function() { $(