Extension jQuery Base

Last modified by newacct on Fri, September 10, 2010 00:37
Source|Old Revisions  

This is an old revision of the document!


Extension jQuery Base

NEW: Extension jQuery Base is available in Magento Connect http://www.magentocommerce.com/extension/1619/mxperts--jquery-base

Intro

jQuery can be easily used with other libraries so it should work out of the box with Magento. But in fact, it’s not... cause of an old version of scriptaculous not written with other libraries in mind.

How To

Scriptaculous

<action method="addJs"><script>scriptaculous/effects.js</script></action>

to

<action method="addJs"><script>scriptaculous/effects-1.8.1.js</script></action>

jQuery

jQuery.noConflict();
  • Rename the file to jquery-1.2.6.noConflict.min.js
  • Copy the file to the directory js/jquery/
  • In page.xml, add it to the list of js files:
<action method="addJs"><script>jquery/jquery-1.2.6.noConflict.min.js</script></action>

Use it

- 1st way (notice the function($))

  jQuery(document).ready(function($){
      // Use jQuery with $(...)
      $('div').show();
  });
  // Use Prototype with $(...)
   $('id').hide();

- 2d way

jQuery(document).ready(function(){
    // Use Prototype with $(...)
    $('id').hide();
    // Use jQuery with jQuery(...)
    jQuery('div').show();
});

Happy jQuery, jQuery plugins & jQuery UI ;)




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs