jquery-animate

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

拥有回忆 提交于 2019-12-03 11:21:37
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).hide(); $('#search, #go-chat').animate({width: '573px'}, 1000, function() { $(this).show(); } ); } ); });

Basic jQuery animation: Elipsis (three dots sequentially appearing)

淺唱寂寞╮ 提交于 2019-12-03 09:57:26
问题 What I need: I need an animated elipisis (...), one dot appearing after the other. The animation needs to loop. I'd like to achieve this via jQuery Animation sequence: Frame 1: Awaiting your selection Frame 2: Awaiting your selection . Frame 3: Awaiting your selection .. Frame 4: Awaiting your selection ... What I've tried: I've been researching a plugin to blink text and the pulsate .effect(). My question: Does anyone have any reccomendations on the simplest and most reliable means of

jquery “animate” variable value

风流意气都作罢 提交于 2019-12-03 09:02:49
问题 I need to "animate" a variable with jquery. Example: The variable value is 1. The value should be 10 after 5 seconds. It should be increase "smoothly". Hope that you know what I mean. Thank you! 回答1: What you require is the step parameter in the $().animate function. var a = 1; jQuery('#dummy').animate({ /* animate dummy value */},{ duration: 5000, step: function(now,fx){ a = 1 + ((now/100)*9); } }); demo 回答2: try: $({someValue: 0}).animate({someValue: 10}, { duration: 5000, step: function()

Jquery - Expand image height and width 20% on hover

杀马特。学长 韩版系。学妹 提交于 2019-12-03 08:37:56
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 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 * 1.2; }); }, function() { $(this).height(function(i, h) { return h / 1.2; }) .width(function(i, w) { return

jQuery .animate() callback infinite loop

元气小坏坏 提交于 2019-12-03 08:28:13
A simple question: Why can I do this var start = function() { $('#element').animate({}, 5000, 'linear', start); } but not this function start() { $('#element').animate({}, 5000, 'linear', start()); } ? The first works perfectly, restarting the animation after it completes. The second simply causes an infinite loop. Either use function start() { $('#element').animate({}, 5000, 'linear', start); } or function start() { $('#element').animate({}, 5000, 'linear', function(){ start(); }); } second case is useful if you want to actually pass some arguments to start.. it's because in the first one you

Animating jQueryUI Sortable using CSS3 transitions

﹥>﹥吖頭↗ 提交于 2019-12-03 07:59:58
How can I use CSS3 transitions (or any other means) to make a jQuery Sortable act more like the list re-ordering in iOS, where list items smoothly animate while dragging, so items scurry out of the way as you drag? [editing to turn this into an FAQ and save time for anyone else who wants to figure this out] https://gist.github.com/801570 shows how to smoothly animate dragging using jQuery Sortable . Items scurry out of the way as you drag. It uses CSS3 Transitions and the effect was exactly what I am looking for. Very cool. Here's the code: JSFIDDLE: http://jsfiddle.net/LTWMp/ HTML: <style

how to animate numbers using Jquery

烈酒焚心 提交于 2019-12-03 07:08:29
问题 I am trying to animate a say $233 to $250 or decreasing from 250 to 233 ,i dont want to replace 233 by 250 instead i want a counter kind of effect and at the time of scrolling numbers zoom effect is also required. i am new to Jquery any help would be highly appreciated. 回答1: HTML <button id="start">Start</button> <button id="reset">Reset</button> <input id="counter" value="233"/> JavaScript $(function () { var $start = $('#start'), start = $start.get(0), $reset = $('#reset'), reset = $reset

jquery animate position in percentage

徘徊边缘 提交于 2019-12-03 07:08:27
how do I determine the positions in percentages? $(document).ready(function(){ $("#button").toggle(function(){ $("#slide").animate({top:-100%},1000); },function(){ $("#slide").animate({top:0%},1000); }); }); Please suggest. $(document).ready(function(){ $("#button").toggle(function(){ $("#slide").animate({top:'-100%'},1000); },function(){ $("#slide").animate({top:'0%'},1000); }); }); Add quotes. (I used single quotes, but js doesn't care if it is ' or ") 来源: https://stackoverflow.com/questions/11015399/jquery-animate-position-in-percentage

How to scroll div continuously on mousedown event?

家住魔仙堡 提交于 2019-12-03 07:04:01
I have two divs and two buttons: <div id="container"> <div id="items"></div> </div> <div id="up"></div> <div id="down"></div> How to continuously scroll '#items' until user releases the button? I tried using jquery mousedown event and animate function but couldn't make it to work. $("#up").mousedown(function(){ $("#items").animate({"top": "+=10px"}, "fast"); }) The code above moves the div just once. I want to achieve continuous animation until the button is released. Thanks for your help! Please, try this: var scrolling = false; jQuery(function($){ $("#up").mousedown(function(){ scrolling =

How to make multiple jQuery animations run at the same time?

南笙酒味 提交于 2019-12-03 07:03:42
As it stands there us a difference between the two and I want them to run at the same time. Here is the code: $(selector1).animate({ height: '670' }, 2000, function() { // Animation complete. }); $(selector2).animate({ top: '670' }, 2000, function() { // Animation complete. });​ andlrc Using queue:false . You can see the full docs here. $(selector1).animate({ height: '670' }, { duration: 2000, queue: false, complete: function() { /* Animation complete */ } }); $(selector2).animate({ top: '670' }, { duration: 2000, queue: false, complete: function() { /* Animation complete */ } }); Docs: