21293 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1435 Views |
-
jQuery conflict with userforms

9 March 2011 at 12:15am
Some threads indicate there is a general chance of jQuery-conflicts with userforms.
I am using jQuery jScrollPane for individual ScrollPanes on a project. Works perfectly on all extended Pages except the ones where I use UDF. On these nothing happens and I get thrown the Error:
Uncaught TypeError: Object #<an Object> has no method 'jScrollPane'
Others seem to also have troubles adding their own jQuery-Code to UDF-pages. I haven't found a proper solution though. I have included the script files in the Page.php:
Requirements::javascript("mysite/javascript/jquery-1.4.2.js");
Requirements::javascript("mysite/javascript/jquery-ui-1.8.custom.min.js");
Requirements::javascript("mysite/javascript/jquery.mousewheel.js");
Requirements::javascript("mysite/javascript/jquery.jscrollpane.js");
Requirements::javascript("mysite/javascript/mwheelIntent.js");
Requirements::javascript("mysite/javascript/bgss_script.js");They all get loaded correctly, and, as said, work perfectly on all other pages. I appreciate any suggestion.
Thanks
Samy -
Re: jQuery conflict with userforms

9 March 2011 at 2:12am
Ok, I found a working solution. This might help other beginners, too:
$.noConflict();
jQuery(document).ready(function($){
$(function()
{
$('#Content').jScrollPane({showArrows: true});
});
}); -
Re: jQuery conflict with userforms

9 March 2011 at 10:07pm
That solution seems quite verbose!
You normally just need to wrap your own code in a closure. I use UDF + scrollpane on a couple of my sites..
(function($) {
$(document).ready(function() {// your code;
})
})(jQuery); -
Re: jQuery conflict with userforms

10 March 2011 at 2:04am
Hi Willr,
thanks for your advise. Your code works well!
Samy
| 1435 Views | ||
|
Page:
1
|
Go to Top |

