Plugin Stopped working with JQuery 1.9.1 -
some time ago created balloon plugin using jquery 1.8.3.
when updated jquery 1.8.3 jquery 1.9.1 plugin stoped working.
the balloons not show anymore. went 1.8.3 , works.
i tried understand might wrong can't find it.
could someone, please, me out? 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);
use jquery migrate find out need fix jquery 1.9.
this plugin can used detect , restore apis or features have been deprecated in jquery , removed of version 1.9. see warnings page more information regarding messages plugin generates. more information changes made in jquery 1.9, see upgrade guide , blog post.
in web page, load plugin after script jquery:
<script src="http://code.jquery.com/jquery-1.9.0.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script>
Comments
Post a Comment