jquery-animate

Toggle animation?

久未见 提交于 2019-12-21 21:35:58
问题 I have this code: $('.couch-hide').click(function() { $(this).animate({right:0},1000, 'easeOutBounce'); }); I am trying to get it to toggle, so on first click, pop it out, then click again, and place it back inside. Would i need to set a variable as a tracker? To tell what stage it is at? 回答1: Just save the original value somewhere, and remember to stop any in-progress animation before starting a new one. The animation routines will take care of the rest: var panel = $('.couch-hide'); var

Error with Javascript / Jquery timing in inactive tabs

亡梦爱人 提交于 2019-12-21 13:02:22
问题 I have recently took on the task of building a animation in Javascript / jQuery. The animation consists of a circle moving around the london tube map. Each time it passes a station, the station name is underlined. I am still working on refining it and noticed that when the tab is inactive if messes the timing of the sequence when coming back to the page. Because I am embedding it inside an iframe It does not seem to work when I use $(window).focus() or $(window).blur() . I have animated the

How to transition child when parent goes from display: none to block

情到浓时终转凉″ 提交于 2019-12-21 07:19:10
问题 I'm having trouble creating a flyout menu with a specific effect. The flyout goes from display:none to block and then I use jquery to animate opacity from 0 to 1 (and vice versa). This is necessary because otherwise the transition does not happen when the element has just had it's display property changed. I did not think that this would propagate to children. But inside of my flyout I have 4 columns of links that have an opacity transition, each with it's own delay so they come in one at a

Javascript/jQuery animate to dynamic height?

旧城冷巷雨未停 提交于 2019-12-21 05:29:20
问题 Does anyone know why this animates fine: function setContainerHeight() { $(".pagecontainer").animate({ height: '700px' }, 500); } i.e. a fixed height, but this doesn't animate at all? function setContainerHeight() { $(".pagecontainer").animate({ height: 'auto' }, 500); } It still resizes to auto, but no animation, just snaps to it. My code: JS: <script> function setContainerHeight() { $(".pagecontainer").animate({ height: 'auto' }, 500); } $('.link').on('click', function(e){ $('.pagecontainer

Animate/Ease an element to position when other elements disappear

不问归期 提交于 2019-12-21 04:26:06
问题 Please take a look at this fiddle: http://jsfiddle.net/dhcyA/ Try clicking on a block. What I want is that when the other elements disapear, the selected block will animate/ease to his giving position instead of just jumping like it does now. Then the same animation repeats itself when clicking again on the box, but then back to place. Maybe to keep in mind: I'm using a reponsive design, which means those blocks can be vertical and horizontal after scaling the window. Any redevisions on the

jQuery multiple animate() callback

懵懂的女人 提交于 2019-12-21 04:17:36
问题 I'm trying to animate a set of elements simultaneously (almost, there's a small delay between each animation): $('.block').each(function(i){ $(this).stop().delay(60 * i).animate({ 'opacity': 1 }, { duration: 250, complete: mycallbackfunction // <- this fires the callback on each animation :( }); }); How can I run a callback function after all animations have completed? 回答1: Use a closure around a counter variable. var $blocks = $('.block'); var count = $blocks.length; $blocks.each(function(i)

jQuery animate() to hide and show elements by sliding left and right

旧时模样 提交于 2019-12-21 03:44:20
问题 I'm trying to animate something using jQuery. UPDATE I have it working the way I want it. This is the jQuery: $(document).ready(function() { // go chat button $('#go-chat input').click(function() { $('#search, #go-chat').animate({width: '0px'}, 1000, function() { $(this).hide(); $('#login, #go-search').animate({width: '573px'}, 1000, function() { $(this).show(); } ); } ); }); $('#go-search input').click(function() { $('#login, #go-search').animate({width: '0px'}, 1000, function() { $(this)

Jquery - Expand image height and width 20% on hover

僤鯓⒐⒋嵵緔 提交于 2019-12-21 02:45:09
问题 Evening all - Whats the best way to access an image's height and width dynamically . I want to add 20% to an images width and height and animate when the surrounding div is hovered, I guess I need to use 'this', but not sure how to access the image. Any help greatfully received. Cheers Paul 回答1: You could do something like this, using .height() and .width() with function arguments: $("img").hover(function() { $(this).height(function(i, h) { return h * 1.2; }) .width(function(i, w) { return w

Smooth jQuery-like animation in GWT

心不动则不痛 提交于 2019-12-20 18:36:12
问题 I'm playing with GWT's Animation class as an exercise. My goal is not to create yet another widget/animation library for GWT. Also, I'm well aware that there are many libraries that do this. What I'm trying to do is learn how this can be done, not how to use some library. This is for educational purposes only.... With that said, I've implemented a simple class that performs 4 different animations on some widget: fade in, fade out, slide in, and slide out (following jQuery's animation model).

HTML5/CSS3 - how to make “endless” rotating background - 360 degrees panorama

牧云@^-^@ 提交于 2019-12-20 10:46:27
问题 i have a JPG image with the 360 degrees view of the city (9000px by 1000px). I need to create a page with endlessly rotating background - giving user an impression of rotating webcamera, for example. The first part - scrolling from left to the very right of the image is very simple - just use jQuery.animate(...). But how can I return seamlessly to the beginning of the image (after it has completed 359 degree turn), so user won't notice "jump" or something like that? Is there any examples on