rss
twitter
    Find out what I'm doing, Follow Me :)

Monday, November 23, 2009

Pin It

Widgets

How to use jQuery with Magento?

Download jQuery from jQuery site

Add this line to the bottom of jQuery.js

    CODE:

    1-jQuery.noConflict();

Copy the file to the js/jquery folder|directory

In page.xml, add it to the list of js files as:

    CODE:

    1-<action method=“addJs“><script>jquery/jquery-1.2.6.noConflict.min.js</script></action>

or,

    CODE:

    1-<action method=“addItem“><type>js</type><name>jquery.js</name><params/></action>

How to use jQuery with magento now?

The below procedure is one way.

    CODE:

    1-jQuery(document).ready(function($){
    2-// Use jQuery with $(...)
    3-$('div').show();
    4-});
    5-// Use Prototype with $(...)
    6-$('id').hide();

note: $ sign inside function($).

And another procedure is,

    CODE:

    1-jQuery(document).ready(function(){
    2-// Use Prototype with $(...)
    3-$('id').hide();
    4-// Use jQuery with jQuery(...)
    5-jQuery('div').show();
    6-});

There are few more procedures available at jQuery site. But this much information is good to go with using jQuery with magento which uses prototype, scriptaculous etc...

No comments:

Post a Comment