ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

jquery animation queue

Автор: kudvenkat

Загружено: 2015-05-17

Просмотров: 35998

Описание: Link for all dot net and sql server video tutorial playlists
https://www.youtube.com/user/kudvenka...

Link for slides, code samples and text version of the video
http://csharp-video-tutorials.blogspo...

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
   / @aarvikitchen5572  

In this video we will discuss how jQuery animation queues work.

When several calls to animate() method are chained together. By default these calls are placed into a queue to be executed one after the other in series rather than executing all of them simultaneously in parallel. The name of this queue is fx.

Each HTML element has its own queue. With the following code there will be 5 calls to animate method placed in the queue of each div element. This means both div elements (myDiv1 & myDiv2) may start to execute the first call to animate method more or less at the same time. However, from the given queue the queued methods are executed one after the other in series.

$('#myButton').click(function () {
$('#myDiv1')
.animate({ 'width': 500 }, 1500)
.animate({ 'padding': 20 }, 1500)
.animate({ 'font-size': 50 }, 1500)
.animate({ 'border-width': 10 }, 1500)
.animate({ 'opacity': 1 }, 1500);

$('#myDiv2')
.animate({ 'width': 500 }, 1500)
.animate({ 'padding': 20 }, 1500)
.animate({ 'font-size': 50 }, 1500)
.animate({ 'border-width': 10 }, 1500)
.animate({ 'opacity': 1 }, 1500);
});

The following code finds the total number of method calls waiting in the queue. While the first call to animate method is being executed, the other calls are added to the queue and waiting to be executed one after the other in sequence.

$('#myDiv1')
.animate({ 'width': 500 }, 1500)
.queue(function () {
console.log('Queued calls = ' +
$(this).queue('fx').length); $(this).dequeue();
})
.animate({ 'padding': 20 }, 1500)
.animate({ 'font-size': 50 }, 1500)
.animate({ 'border-width': 10 }, 1500)
.animate({ 'opacity': 1 }, 1500)
.queue(function () {
console.log('Queued calls = ' +
$(this).queue('fx').length); $(this).dequeue();
});

To globally disable all animations
$.fx.off = true or jQuery.fx.off = true

If you want the calls to animate() to be executed simultaneously in parallel, then set queue option to false. Modify the jQuery code as shown below.

$('#myDiv1')
.animate({ 'width': 500 }, { duration: 1500, queue: false })
.animate({ 'padding': 20 }, { duration: 1500, queue: false })
.animate({ 'font-size': 50 }, { duration: 1500, queue: false })
.animate({ 'border-width': 10 }, { duration: 1500, queue: false })
.animate({ 'opacity': 1 }, { duration: 1500, queue: false });

$('#myDiv2')
.animate({ 'width': 500 }, { duration: 1500, queue: false })
.animate({ 'padding': 20 }, { duration: 1500, queue: false })
.animate({ 'font-size': 50 }, { duration: 1500, queue: false })
.animate({ 'border-width': 10 }, { duration: 1500, queue: false })
.animate({ 'opacity': 1 }, { duration: 1500, queue: false });

There are 2 variations of animate method. We discussed Variation 1 in Part 46 of jQuery tutorial. In the code snippet above we are using Variation 2.

Variation 1
.animate( properties [, duration ] [, easing ] [, complete ] )

Variation 2
.animate( properties, options )

For the list of all additional options that you can pass to animate method please check http://api.jquery.com/animate

An easier way to animate multiple css properties simultaneously in parallel, is to include all those css properties in a single JSON object.

$('#myDiv1')
.animate({
'width': 500,
'padding': 20,
'font-size': 50,
'border-width': 10,
'opacity': 1
}, 1500);

$('#myDiv2')
.animate({
'width': 500,
'padding': 20,
'font-size': 50,
'border-width': 10,
'opacity': 1
}, 1500);

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
jquery animation queue

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Simple jquery progress bar

Simple jquery progress bar

jQuery DOM manipulation methods

jQuery DOM manipulation methods

optimize jquery progress bar

optimize jquery progress bar

jquery floating div

jquery floating div

Михаил Задорнов «Как КГБшник часы выбирал»

Михаил Задорнов «Как КГБшник часы выбирал»

Кто переживет войну в Иране?

Кто переживет войну в Иране?

jQuery tutorial for beginners

jQuery tutorial for beginners

Владимир Жириновский дал прогноз по ситуации с Ираном

Владимир Жириновский дал прогноз по ситуации с Ираном

Торч в тупике. Стокфиш показал, кто главный на шахматной доске.

Торч в тупике. Стокфиш показал, кто главный на шахматной доске.

Математик и черт

Математик и черт

Как защитить API: Уязвимости и решения

Как защитить API: Уязвимости и решения

Что такое теория относительности, 1964 год

Что такое теория относительности, 1964 год

jquery animate function

jquery animate function

Первый “Баг” в Истории - и Женщина, Которая Изменила Программирование

Первый “Баг” в Истории - и Женщина, Которая Изменила Программирование

Nginx — Простым языком на понятном примере

Nginx — Простым языком на понятном примере

jQuery: Manipulate jQuery Queue using queue() and dequeue() Methods

jQuery: Manipulate jQuery Queue using queue() and dequeue() Methods

Жириновский: остатки Ирана и Турции войдут в состав России! Воскресный вечер с Соловьевым. 13.05.18

Жириновский: остатки Ирана и Турции войдут в состав России! Воскресный вечер с Соловьевым. 13.05.18

Optimise jQuery image gallery

Optimise jQuery image gallery

ЖЕСТКАЯ БИТВА Двух ЧЕМПИОНОВ в 100 ходов! МАГНУС Карлсен-Анатолий Карпов!Шахматы Блиц

ЖЕСТКАЯ БИТВА Двух ЧЕМПИОНОВ в 100 ходов! МАГНУС Карлсен-Анатолий Карпов!Шахматы Блиц

Электричество НЕ течёт по проводам — тревожное открытие Фейнмана

Электричество НЕ течёт по проводам — тревожное открытие Фейнмана

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]