From 56566c1c4d23313a74ce4d0dcf0b3a5041ebea72 Mon Sep 17 00:00:00 2001 From: Fokke Date: Mon, 5 May 2014 22:25:20 +0300 Subject: [PATCH] Change deprecated live method to on() --- InputfieldCropImage/InputfieldCropImage.js | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/InputfieldCropImage/InputfieldCropImage.js b/InputfieldCropImage/InputfieldCropImage.js index 97f98cc..48078f7 100644 --- a/InputfieldCropImage/InputfieldCropImage.js +++ b/InputfieldCropImage/InputfieldCropImage.js @@ -1,6 +1,23 @@ $(document).ready(function() { - $("a.crop").live("hover", function(e) { + var magnificOptions = { + type: 'image', + closeOnContentClick: true, + closeBtnInside: true, + image: { + titleSrc: function(item) { + return item.el.find('img').attr('alt'); + } + }, + callbacks: { + open: function() { + // for firefox, which launches Magnific after a sort + if($(".InputfieldFileJustSorted").size() > 0) this.close(); + } + } + }; + + $("a.crop").on("hover", function(e) { if( e.type === 'mouseover' || e.type === 'mouseenter') { url = $(this).data('thumburl') + "?timestamp=" + new Date().getTime(); $(this).append(""); @@ -9,8 +26,8 @@ $(document).ready(function() { $(this).find("img").remove(); } }); - - $(".InputfieldCropImage .InputfieldFileList").live('AjaxUploadDone', function() { - $("a.InputfieldFileLink", $(this)).fancybox(); - }); + + $(".InputfieldCropImage .InputfieldFileList").on('AjaxUploadDone', function() { + $("a.InputfieldFileLink", $(this)).magnificPopup(magnificOptions); + }); });