Reputation: 315
I have this piece of javascript code and I must convert it with jquery noConflict in order to make it work with wordpress jquery. Do you have any clue to do this?
var initCharts = function() {
var charts = $('.percentage');
charts.easyPieChart({
animate: 2000
});
}
Thanks for your help
Upvotes: 1
Views: 918
Reputation: 13248
$.noConflict();
(function($) {
$(function() {
// more code using $ as alias to jQuery
});
})(jQuery);
// other code using $ as an alias to the other library
Based on your code:
(function($){
$(document).ready(function() {
var initCharts = function() {
var charts = $('.percentage');
charts.easyPieChart({
animate: 2000
});
}
});
})(jQuery);
Upvotes: 0
Reputation: 9661
http://api.jquery.com/jQuery.noConflict/
jQuery.noConflict();
(function($) {
$(function() {
var initCharts = function() {
var charts = $('.percentage');
charts.easyPieChart({
animate: 2000
});
}
});
})(jQuery);
Upvotes: 2