jquery-animate

Change jQuery's animation duration during animating

我怕爱的太早我们不能终老 提交于 2019-12-06 00:38:03
问题 Is it possible to change the duration of a currently running jQuery animation between two different values? I've tried to change the duration via direct assignment, but no success: var timing = { duration: 4000 }; $(document).click(function (e) { timing.duration = 1000; }); $('#foo').animate({top:200, left:200}, timing); ...and even, changing the fx.options.duration in step -method does not affect the running animation: var state = false, $(document).click(function (e) { state = true; }); $('

jquery animate from object center

不羁岁月 提交于 2019-12-06 00:12:22
I am trying to create a product viewer similar to the one at the bottom of this page http://www.logitech.com/en-gb/ . As you can see the product animates from the center rather than top left which I think is Jquery's default. So what I am doing is trying animate the width and height and then also the offset to make it look like it animates from the center. My code looks like this: <style> body { background: black; } .box { background: #fff url('pic.jpg') no-repeat 0 0; width: 200px; height: 200px; margin: 10px 4%; float: left; } </style> <script type="text/javascript"> $(document).ready

Correcting IE Cleartype/Filter Problem when Animating Opacity of Text with jQuery

假如想象 提交于 2019-12-05 22:22:05
Hey all, I'm having an issue with IE that seems like a fairly known/common bug. I have an image slide show I've built out in jQuery that works flawlessly in other browsers. However, in IE I've run into a problem with the text being anti-aliased once the slide show runs one time. Which is to say, if there are three images in the slide show, then the first time each of those three images appear with their text, the text renders properly. However, once the slide show cycles through the text becomes anti-aliased. I've read up on this and looked through countless blogs about how to best correct it.

How can I animate the opposite way?

非 Y 不嫁゛ 提交于 2019-12-05 22:05:35
Greetings, I am changing the width of an element which serves as a bar , and that works. However I can't make it so that it animates it in the opposite direction. I tried putting - in front of bar_width but to no avail. Width will be dynamically calculated it's just that I want the direction to go to the left rather than to the right like so <------- not -----------> var bar_width=$(this).css('width') ; $(this).css('width', '0').animate({ width: bar_width }, queue:false,duration:3500,easing: easing}); You could animate it from right to left by animating both the margin-left and width of the

How to scroll to element cross browser using jquery animate

為{幸葍}努か 提交于 2019-12-05 20:19:54
This code: jQuery('body').animate({scrollTop: target.offset().top}, 300); Works in firefox, but not chrome. This code: jQuery('html').animate({scrollTop: target.offset().top}, 300); Works in chrome, but not firefox. I haven't tested yet in IE. What is the correct way to do this, cross-browser? If it's not clear from the above snippets, I target is a div on the page, and I want to scroll down slowly to it slowly, so they do exactly what I want... just not cross-browser. Specify both html and body : $("html,body").animate({scrollTop: target.offset().top}, 300); 来源: https://stackoverflow.com

IE8 forces compatibility mode when inserting data into a div

此生再无相见时 提交于 2019-12-05 19:59:26
I've been fighting against IE8's compatibility mode all day and I'm about to chuck a brick at it. I have some code, which uses jquery 1.2 (yes it's old - can't change that), to search for some records in our web app. The results of the search can be clicked on to view the contents of the record (by using .animate() it opens a space under the row and creates another TR underneath and inserts HTML data from a json feed). In IE8, clicking on a result to view the content forces it to reload in compatibility mode, where it works fine in all other browsers (IE7, FF3.0+, Chrome, Safari). I've been

Stop CSS rotate animation smoothly on unknown keyframe

╄→гoц情女王★ 提交于 2019-12-05 18:47:02
I have an image that swings using CSS rotate animation. I would like to stop it smoothly (and put it back to its original position when clicking on another element but without getting the jumpy stop feeling). It seems that the expected behaviour only happens on the first iteration of the animation but not on the upcoming ones (this is when clicking on the "slow" button during the first 2 seconds) Here is a sample code https://jsfiddle.net/pbarrientos/5v3xwak6/ I have already tried adding animation-iteration-count: 1; and adding/removing classes. var css = { '-webkit-animation-iteration-count':

How to animate an image along a path with Bezier curves

别来无恙 提交于 2019-12-05 18:02:31
问题 My goal: Move/animate an image along a path like the drawing below (Could be connecting bezier curves). Must work in IE7+, don't what to build multiple solutions. I can pause/resume the moving image. The image will keep moving along the path (repeat). What I have considered CANVAS: not supported in IE7+8, haven't tested explorercanvas yet! Foresee some z-index issues. SVG, not supported in IE7+8. jQuery.path, a plugin that extends the jQuery animate function. Can't figure out the resume part

How do I use JQuery to select a whole <li> tag and make it a link?

断了今生、忘了曾经 提交于 2019-12-05 18:02:22
I'm trying to create a news list summary section using <ul> and would like to make the whole <li> clickable. I'd like to use to first link it finds in the <li> as the URL so it remains accessible when JavaScript is not enabled...My HTML is:- <h3>Regional news</h3> <ul> <li class="alt clickable"> <h4><a href="/dave.htm">Fusce porta varius eros</a></h4> <h5>22 Feb 2009</h5> <p>Donec bibendum, mauris at vulputate vestibulum, nulla odio eleifend sem, in adipiscing orci neque sit amet ipsum.</p> </li> <li class="clickable"> <h4><a href="/dave.htm">Praesent turpis tellus, sagittis eu, molestie ac,

Execute function on Scroll jQuery

痴心易碎 提交于 2019-12-05 15:26:20
I'm misunderstanding the scroll() function. I'm wishing to if a panel is open execute a function if the main window is scrolled up or down. This is my code that does nothing. if('#specsallA:visible').scroll(function(){ $('#specsbar').animate({ width:'190px' }, '500'); $('.products').animate({ width:'168px' }, '500'); $('#specsallA').hide(); $('#specsall').show(); }); Any ideas, Marvellous A slight misunderstanding. Easiest way is to put your if() test inside the event callback $(window).scroll(function() { if ($('#specsallA').is(':visible')) { // do your special stuff here } }); I think you