Prototype and jQuery conflict |
|
|
|
Written by Administrator
|
marted́, 30 dicembre 2008 |
Prototype and jQuery are two powerful javascript library sets really useful for web pages development and required for a lot of useful free effect scripts available on the net (transparent image effects, sliding and fading image effects etc).
The two libraries require however a small trick to be used together. Here below a simple code to avoid any function assignment conflicts:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
JQ = $; //rename $ function
</script>
<script type="text/javascript" src="prototype.js"></script>
All the jQuery function calls have to be done of course by the new FQ prefix instead of the original $ on as per the following example:
FQ(document).ready(function(){
FQ(".button-slide").click(function(){
FQ("#panel").slideToggle("slow");
FQ(this).toggleClass("active");
});
});
|
Last Updated ( marted́, 30 dicembre 2008 )
|