Конфликт jquery с .delay(xxx).

Главные вкладки

Аватар пользователя fit fit 17 августа 2010 в 1:39

Написал небольшой jquery скрипт для анимации страницы:

$(function() {
$('.frontwork img, .frontwork').animate({ "opacity": 0.0 }, 0);
      $(document).ready(function(){
          $('.frontwork, .frontwork img').stop().animate({ "opacity": 1 }, 2000);
          $('.frontwork .frontindex').delay(1700).slideDown(500);
          $('.frontindex .frontinfo').delay(2000).slideDown(500);
      $('.frontindex .moreinfo').delay(2500).slideDown(500);     
});
});

файрбаг ругается на .delay(1700) - не функция... Конфликт с друпаловским Jquery... помогите решить проблему без потери задержек в скрипте..

Комментарии

Аватар пользователя G.A. Vinogradov G.A. Vinogradov 17 августа 2010 в 12:49

fit wrote:
Где вы такую нашли? http://drupal.org/project/jquery_update
И это не поможет т.к. конфликт от версии не будет зависеть - это уже друпаловские заморочки. Тут совет по Jquery коду был бы уместен.

Где-где...

http://api.jquery.com/delay/
Читаем внимательно:

«Added to jQuery in version 1.4, the .delay() method allows us to delay the execution of functions that follow it in the queue. It can be used with the standard effects queue or with a custom queue. »

Аватар пользователя Виктор Степаньков ака RxB Виктор Степаньк... 17 августа 2010 в 12:44

"fit" wrote:
Написал небольшой jquery скрипт для анимации страницы:

Если это полный исходник скрипта, то как минимум ошибка в:

/**
 * Attach all registered behaviors to a page element.
 *
 * Behaviors are event-triggered actions that attach to page elements, enhancing
 * default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors
 * object as follows:
 * code
 *    Drupal.behaviors.behaviorName = function () {
 *      ...
 *    };
 * endcode
 *
 * Drupal.attachBehaviors is added below to the jQuery ready event and so
 * runs on initial page load. Developers implementing AHAH/AJAX in their
 * solutions should also call this function after new page content has been
 * loaded, feeding in an element to be processed, in order to attach all
 * behaviors to the new content.
 *
 * Behaviors should use a class in the form behaviorName-processed to ensure
 * the behavior is attached only once to a given element. (Doing so enables
 * the reprocessing of given elements, which may be needed on occasion despite
 * the ability to limit behavior attachment to a particular element.)
 *
 * param context
 *   An element to attach behaviors to. If none is given, the document element
 *   is used.
 */
Аватар пользователя fit fit 17 августа 2010 в 19:06

"G.A. Vinogradov" wrote:
Где-где...

http://api.jquery.com/delay/
Читаем внимательно:

«Added to jQuery in version 1.4, the .delay() method allows us to delay the execution of functions that follow it in the queue. It can be used with the standard effects queue or with a custom queue. »

Я про то, что друпал не может обновить свой jquery до 1.4 !!! до 1.2 только...

Аватар пользователя fit fit 17 августа 2010 в 19:20

Короче разобрался.. Вот альтернатива без delay():

$(function() {
$('.frontwork img, .frontwork').fadeTo(400, 1).animate({ "opacity": 0.0 }, 0);
      $(document).ready(function(){
          $('.frontwork, .frontwork img').stop().animate({ "opacity": 1 }, 2000);
          $('.frontwork .frontindex').fadeTo(1700, 1).slideDown(500);
          $('.frontindex .frontinfo').fadeTo(2000, 2).slideDown(500);
      $('.frontindex .moreinfo').fadeTo(2500, 3).slideDown(500);         
});
});