Plugins stops working wehn upgrading from JQuery 1.8.3 to JQuery 1.9.1. Could someone, please, help me out?
Hello,
Some time ago I created a Balloon plugin using JQuery 1.8.3.
When I updated from JQuery 1.8.3 to JQuery 1.9.1 my plugin stoped working.
The balloons do not show anymore. I went back to 1.8.3 and it works.
I tried to understand what might be wrong but I can't find it.
Could someone, please, help me out? This is my code:
- (function ($) {
- $.fn.Balloon = function (options) {
- var defaults = {
- balloon: "",
- class: "Balloon",
- click: false,
- id: "Balloon",
- sensible: false,
- x: -4,
- y: -40
- };
- var options = $.extend({}, defaults, options);
- var balloon;
- $(this).each(function () {
- var title = $(this).attr("title");
- if (title == undefined) return;
- $(this).hover(function (e) {
- $(this).removeAttr("title")
- balloon = "<div id='{id}' class='{class}'><span class='Text'>{content}</span><span class='Background'></span></div>"
- if (options.balloon == "") {
- balloon = balloon.replace("{class}", options.class).replace("{id}", options.id).replace("{content}", title);
- } else {
- balloon = balloon.replace("{class}", options.class).replace("{id}", options.id).replace("{content}", options.balloon).replace("{title}", title);
- }
- $("body").append(balloon);
- $("#" + options.id).fadeIn("fast");
- },
- function () {
- $("#" + options.id).remove();
- $(this).attr("title", title);
- });
- $(this).mousedown(function (e) {
- if (options.click) {
- $("#" + options.id).remove();
- $(this).attr("title", title);
- }
- }),
- $(this).mousemove(function (e) {
- var x = e.pageX + options.x;
- var y = e.pageY + options.y;
- if (options.sensible) {
- var width = $("#" + options.id).width();
- var height = $("#" + options.id).height();
- var right = $(window).width() - (x + width);
- var bottom = $(window).height() - (y + height);
- if (right < 20) {
- x = e.pageX - width - options.x;
- }
- if (bottom < 20) {
- y = e.pageY - height - options.y;
- }
- }
- $("#" + options.id).css({ top: y, left: x });
- }); // Mouse Move
- }); // Balloon
- };
- })(jQuery);
Thank You,
Miguel