jquery-animate

Using jQuery to change div width from 50% to 70% on hover

拜拜、爱过 提交于 2019-12-01 04:34:03
问题 I have two divs that have 50% width each. I want to make it so that the the hovered div expands to 70% and the other reduces to 30%. And when the mouse moves out, they both return to 50% each. I wrote a script but it doesn't give the right results. The widths are fluid so they need to adjust to all window sizes. how Can I make this work right? I didn't write the mouseout function yet as the mouseover doesn't function correctly. Here's how it works now: http://jsfiddle.net/kYZyp/ Here's my

Animate jQuery scrolltop

我只是一个虾纸丫 提交于 2019-12-01 04:25:51
问题 I have a scrollTop function in jQuery but I can't animate it. Is it possible? $(".loadmore").click(function() { $(this).toggleClass("up-arrow", 1000); $(window).scrollTop($('.docs').offset().top, 2000); }); 回答1: You can use animate() for this. Example code applied on a div is as follows : //Scroll to bottom $('div').animate({scrollTop: $('div').get(0).scrollHeight}, 3000); //$('div').get(0).scrollHeight - will give the full height of div. //scrollTop - will be used to animate from the current

Does animating the value of a CSS3 transform with javascript rule out hardware acceleration?

爷,独闯天下 提交于 2019-12-01 04:23:30
You can take advantage of hardware accelerated animations by setting an animation duration and setting the initial and final values of the CSS3 transform. What if, instead of setting an animation duration and using keyframes, you animate the value of the desired CSS3 transform directly with JavaScript? Will you still be taking advantage of hardware acceleration, or is the hardware acceleration ruled out? It is hardware accelerated, but as Rich mentions, it's easier and more efficient to do it with CSS transitions. The thing is that animating 3d transforms with jQuery is not straightforward, if

How to continuously rotate children in a jQuery animation?

╄→гoц情女王★ 提交于 2019-12-01 04:19:50
问题 I have a div with class 'bannergroup' that contains multiple divs 'banneritem'. I want these items to rotate (fade in then fade out) in place of each other. I can have several divs with the class bannergroup and each one should rotate separately. Here is the HTML: <div class="bannergroup"> <div class="banneritem">Only visible one at a time</div> <div class="banneritem">Only visible one at a time</div> <div class="banneritem">Only visible one at a time</div> <div class="banneritem">Only

Losing hover when animating with jQuery (without moving mouse)

好久不见. 提交于 2019-12-01 04:11:06
I have this row of thumbnails that I am animating with jQuery. Each of these thumbnails has a hover and active class. They work fine but when I animate the list, the new thumbnail under the mousecursor does not apply the hover? I have to move the mouse a little bit after each click? It's kinda difficult to exaplain.. I have made a fiddle here: http://jsfiddle.net/nZGYA/ When you start clicking after thumb 3 without moving the mouse you see what I mean... It works fine in FireFox, NOT Safari, Chrome, IE etc. Is there something I can do about this? For reference here is my code: <style type=

jquery animate for element attributes not style

旧街凉风 提交于 2019-12-01 03:19:54
ASAIK jquery animate function accepts style properties only. but i want to animate the attributes of an element. consider a SVG element rectangle <svg> <rect id="rect1" x=10 y=20 width="100px" height="100px"> </svg> i want to animate the rectangle element attribute "x" and "y" something like below $("#rect1").animate({ x: 30, y: 40 }, 1500 ); but it is not correct way because animate function affects style not attribute of an element. i knew so many custom plugin is there like raphel.js . http://raphaeljs.com/ but i don't want to use custom plugin to do this. i want to do this simply in jquery

JQuery: Children Disappear on Parent Size Animation

天涯浪子 提交于 2019-12-01 03:15:44
问题 In this simplified version of a hierarchical diagram, child elements disappear when their parent's size is animated. Is there any way to prevent this? <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <style type="text/css"> div { position:absolute; width:40px; height: 40px; background: #f00; } </style> </head> <body> <script language="javascript"> $(document).ready(function (e) { $('div').hover(function (e) { e

jQuery Animate top (From bottom to top)

社会主义新天地 提交于 2019-12-01 03:03:19
I am trying to animate a Div a top:275 . I tried .animate( {marginTop: -820 } but on each screen it ends up to a different position. . . So I changed the marginTop to .animate( {top: 275} but the div comes from the top to down (slidedown). Note that, so I can use the animate:top I had to set the div to position:absolute during the animation. . . Is there any hackyway to make the top come from the bottom up or make the marginTop have the same distance from the top on each screen resolution ? ( I assume margintop can't be solved since im setting margin top to -820 in order to get at a point of

jQuery to change (with fade animation) background image of div on hover

独自空忆成欢 提交于 2019-12-01 02:49:35
问题 I am trying to change the background image of a div on hover with jQuery. This is what I came up so far, however, it's not working: html <div class="logo"></div> css .logo { width: 300px; height: 100px; background: url('http://placehold.it/300x100/ffffff/000000.png&text=first') no-repeat center top; } js $('.logo').hover( function(){ $(this).animate({backgroundImage: 'http://placehold.it/300x100/ffffff/000000.png&text=second'},'fast'); }, function(){ $(this).animate({backgroundImage: 'http:/

jquery add a fade to an .addClass

こ雲淡風輕ζ 提交于 2019-12-01 02:25:37
How do I fade .addClass in and out. Here is the link - http://www.bikramyogajoondalup.com.au/about-bikram-yoga/postures-benefits.html and here is the code - $(document).ready(function() { $('#menu li#Q_01,#menu li#Q_03,#menu li#Q_05,#menu li#Q_07,#menu li#Q_09,#menu li#Q_11,#menu li#Q_13').hover(function() { $(this).addClass('pretty-hover'); }, function() { $(this).removeClass('pretty-hover'); }); }); $(document).ready(function() { $('#menu li#Q_02,#menu li#Q_04,#menu li#Q_06,#menu li#Q_08,#menu li#Q_10,#menu li#Q_12').hover(function() { $(this).addClass('pretty-hover_01'); }, function() { $