Search code examples
jqueryprototypejsscriptaculous

Use scriptaculous effects in jQuery code


jQuery sliding animations are choppy unlike scriptaculous ones. So i want to replace my jQuery .slideUp/Down() with Scritaculous

Basically, use scriptaculous slideup/down in this code ->

jQuery('.button').on('click', function(){
jQuery('#box').slideUp();
});

Is it possible? if yes, what would be correct way to use sciptaculous slide in the code above?

note: i already have prototype.js included in the page and i DON't want to rewrite all my jquery code to prototype


Solution

  • You want to use the BlindUp method

    and I would suggest attaching the event using prototypejs if you want to use scriptaculous on an element - you don't have to though.

    Based on your example jquery code you are attaching to the click event for all of the .button class elements - equivalent code below.

    $$(".button").invoke("observe","click",function(){
        $("box").blindUp()
    });
    

    http://madrobby.github.com/scriptaculous/effect-blindup/