From e8960b61c10b8cd28881912e0b09301d2d7947f2 Mon Sep 17 00:00:00 2001 From: razmig Date: Wed, 12 Feb 2014 23:47:22 +0100 Subject: [PATCH 01/12] cleanup the code, add possible array of open and array of close button, plus open and close event listeners, plus open and close callbacks --- index.html | 59 +++++++++++++++++ modalPopLite.js | 167 ++++++++++++++++++++++++++++-------------------- 2 files changed, 158 insertions(+), 68 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..2b21ba2 --- /dev/null +++ b/index.html @@ -0,0 +1,59 @@ + + + + + + A Simple Lightweight jQuery Modal Popup Box. + + + + + + + + + + A Simple Lightweight Modal Popup Box.
+ Option 'isModal' is set to true - if you want to be able to click the background to close the popup set it to false (which is the default). +

+ +
+ Click Me! +
+ + + + diff --git a/modalPopLite.js b/modalPopLite.js index d823a79..f0d0c32 100644 --- a/modalPopLite.js +++ b/modalPopLite.js @@ -30,98 +30,129 @@ * Based on jQuery from 1.7 to 1.11.0 / 2.1.0 */ -(function ($) { - var popID = 0; - $.fn.modalPopLite = function (options) { - var options = $.extend({}, { openButton: "modalPopLite-open-btn", closeButton: "modalPopLite-close-btn", isModal: false, callBack: null }, options); +(function ($, window) { + var popID = 0, + modalPopLite_mask = "#modalPopLite-mask", + modalPopLite_wrapper = "#modalPopLite-wrapper"; + + $.fn.modalPopLite = function (settings) { + var options = $.extend({}, { + openButton: "modalPopLite-open-btn", + closeButton: "modalPopLite-close-btn", + isModal: false, + openCallback: null, + closeCallback: null + }, settings); return this.each(function () { popID++; - var thisPopID = popID; - var isOpen = false; + var thisPopID = popID, + isOpen = false, + + obj = $(this), + triggerObj = options.openButton, + closeObj = options.closeButton, + isReallyModel = options.isModal, + openCallback = options.openCallback, + closeCallback = options.closeCallback, + + resizeWindow = function () { + var winW = $(window).width(), + winH = $(window).height(), + objW = $('.modalPopLite-child-' + thisPopID).outerWidth(), + objH = $('.modalPopLite-child-' + thisPopID).outerHeight(), + left = (winW / 2) - (objW / 2), + top = (winH / 2) - (objH / 2); + + $(modalPopLite_wrapper + thisPopID).css({ 'left': left + "px", 'top': top }); + $(modalPopLite_mask + thisPopID).css('height', winH + "px"); + }, + openPopLiteModal = function () { + resizeWindow(); + $(modalPopLite_mask + thisPopID).fadeTo('slow', 0.6); + $(modalPopLite_wrapper + thisPopID).fadeIn('slow'); + isOpen = true; - var obj = $(this); - var triggerObj = options.openButton; - var closeObj = options.closeButton; - var isReallyModel = options.isModal; + if (typeof openCallback === 'function') { + openCallback(); + } + }, + closePopLiteModal = function () { + $(modalPopLite_mask + thisPopID).hide(); + $(modalPopLite_wrapper + thisPopID).css('left', "-10000px"); + + isOpen = false; + + if (typeof closeCallback === 'function') { + closeCallback(); + } + }; - //alert("winH: " + winH + "top: " + top + "objH: " + objH); obj.before('
'); obj.wrap('
'); obj.addClass('modalPopLite-child-' + thisPopID); - $(triggerObj).on("click", function (e) { - e.preventDefault(); - var winW = $(window).width(); - var winH = $(window).height(); - var objW = $('.modalPopLite-child-' + thisPopID).outerWidth(); - var objH = $('.modalPopLite-child-' + thisPopID).outerHeight(); - var left = (winW / 2) - (objW / 2); - var top = (winH / 2) - (objH / 2); - - $('#modalPopLite-mask' + thisPopID).css('height', winH + "px"); - $('#modalPopLite-mask' + thisPopID).fadeTo('slow', 0.6); - //$('#modalPopLite-wrapper' + thisPopID).hide(); - $('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top }); - $('#modalPopLite-wrapper' + thisPopID).fadeIn('slow'); - isOpen = true; - }); + // Check if we have array of open buttons + if ($.isArray(triggerObj)) { + for (var i = 0, len = triggerObj.length; i < len; i++) { + triggerObj[i].on("click", function (e) { + e.preventDefault(); + openPopLiteModal(); + }); + } + } else { + $(triggerObj).on("click", function (e) { + e.preventDefault(); + openPopLiteModal(); + }); + } - $(closeObj).on("click", function (e) { - e.preventDefault(); - $('#modalPopLite-mask' + thisPopID).hide(); - //$('#modalPopLite-wrapper' + thisPopID).hide(); - $('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px"); - isOpen = false; - if (options.callBack != null) { - options.callBack.call(this); + // Check if we have array of close buttons + if ($.isArray(closeObj)) { + for (var i = 0, len = closeObj.length; i < len; i++) { + closeObj[i].on("click", function (e) { + e.preventDefault(); + closePopLiteModal(); + }); } + } else { + $(closeObj).on("click", function (e) { + e.preventDefault(); + closePopLiteModal(); + }); + } + + // Bind an event listener on object to trigger open without need to + // click on open button + + obj.bind('openPopLiteModal', function () { + openPopLiteModal(); }); + // Bind an event listener on object to trigger close without need to + // click on open button + + obj.bind('closePopLiteModal', function () { + closePopLiteModal(); + }) + + //if mask is clicked if (!isReallyModel) { - $('#modalPopLite-mask' + thisPopID).click(function (e) { + $(modalPopLite_mask + thisPopID).click(function (e) { + debugger; e.preventDefault(); $(this).hide(); - //$('#modalPopLite-wrapper' + thisPopID).hide(); - $('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px"); - isOpen = false; - if (options.callBack != null) { - options.callBack.call(this); - } + closePopLiteModal(); }); } $(window).resize(function () { if (isOpen) { - var winW = $(window).width(); - var winH = $(window).height(); - var objW = $('.modalPopLite-child-' + thisPopID).outerWidth(); - var objH = $('.modalPopLite-child-' + thisPopID).outerHeight(); - var left = (winW / 2) - (objW / 2); - var top = (winH / 2) - (objH / 2); - $('#modalPopLite-wrapper' + thisPopID).css({ 'left': left + "px", 'top': top }); - $('#modalPopLite-mask' + thisPopID).css('height', winH + "px"); + resizeWindow(); } }); }); }; - $.fn.modalPopLite.Close = function (id) { - $('#modalPopLite-mask' + id).hide(); - //$('#modalPopLite-wrapper' + id).hide(); - $('#modalPopLite-wrapper' + thisPopID).css('left', "-10000px"); - if (options.callBack != null) { - options.callBack.call(this); - } - }; - - $.fn.modalPopLite.ShowProgress = function () { - $('
').appendTo("body") - }; - - $.fn.modalPopLite.HideProgress = function () { - $('.popBox-ajax-progress').remove(); - }; - -})(jQuery); +})(jQuery, window); From 9b61a1108168ed62d8781a79c1910e4089ca3b45 Mon Sep 17 00:00:00 2001 From: razmig Date: Wed, 12 Feb 2014 23:57:58 +0100 Subject: [PATCH 02/12] delete index page --- index.html | 59 ------------------------------------------------------ 1 file changed, 59 deletions(-) delete mode 100644 index.html diff --git a/index.html b/index.html deleted file mode 100644 index 2b21ba2..0000000 --- a/index.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - A Simple Lightweight jQuery Modal Popup Box. - - - - - - - - - - A Simple Lightweight Modal Popup Box.
- Option 'isModal' is set to true - if you want to be able to click the background to close the popup set it to false (which is the default). -

- -
- Click Me! -
- - - - From 38d2dc3ce446c0d9393667aa9c9857e62d7a8b81 Mon Sep 17 00:00:00 2001 From: Razmig Date: Thu, 13 Feb 2014 09:57:25 +0100 Subject: [PATCH 03/12] Update modalPopLite.js remove missed debugger --- modalPopLite.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modalPopLite.js b/modalPopLite.js index f0d0c32..3589346 100644 --- a/modalPopLite.js +++ b/modalPopLite.js @@ -140,7 +140,6 @@ //if mask is clicked if (!isReallyModel) { $(modalPopLite_mask + thisPopID).click(function (e) { - debugger; e.preventDefault(); $(this).hide(); closePopLiteModal(); From 395fd55e0e72b579daaf09a8c26efedef0ebd658 Mon Sep 17 00:00:00 2001 From: razmig Date: Tue, 18 Feb 2014 22:03:17 +0100 Subject: [PATCH 04/12] fix some bugs and add possible array of open and close buttons --- index.html | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ modalPopLite.js | 22 +++++++-------- 2 files changed, 83 insertions(+), 11 deletions(-) create mode 100644 index.html diff --git a/index.html b/index.html new file mode 100644 index 0000000..a200f2a --- /dev/null +++ b/index.html @@ -0,0 +1,72 @@ + + + + + + A Simple Lightweight jQuery Modal Popup Box. + + + + + + + + + + A Simple Lightweight Modal Popup Box.
+ Option 'isModal' is set to true - if you want to be able to click the background to close the popup set it to false (which is the default). +

+ +
+ Click Me! +
+
+ Click Me! +
+
+ Click Me! +
+ + + + diff --git a/modalPopLite.js b/modalPopLite.js index 3589346..3b30232 100644 --- a/modalPopLite.js +++ b/modalPopLite.js @@ -50,13 +50,13 @@ isOpen = false, obj = $(this), - triggerObj = options.openButton, + openObj = options.openButton, closeObj = options.closeButton, isReallyModel = options.isModal, openCallback = options.openCallback, closeCallback = options.closeCallback, - resizeWindow = function () { + resizeBox = function () { var winW = $(window).width(), winH = $(window).height(), objW = $('.modalPopLite-child-' + thisPopID).outerWidth(), @@ -68,7 +68,7 @@ $(modalPopLite_mask + thisPopID).css('height', winH + "px"); }, openPopLiteModal = function () { - resizeWindow(); + resizeBox(); $(modalPopLite_mask + thisPopID).fadeTo('slow', 0.6); $(modalPopLite_wrapper + thisPopID).fadeIn('slow'); isOpen = true; @@ -93,15 +93,15 @@ obj.addClass('modalPopLite-child-' + thisPopID); // Check if we have array of open buttons - if ($.isArray(triggerObj)) { - for (var i = 0, len = triggerObj.length; i < len; i++) { - triggerObj[i].on("click", function (e) { + if ($.isArray(openObj)) { + for (var i = 0, len = openObj.length; i < len; i++) { + $(openObj[i]).on("click", function (e) { e.preventDefault(); openPopLiteModal(); }); } } else { - $(triggerObj).on("click", function (e) { + $(openObj).on("click", function (e) { e.preventDefault(); openPopLiteModal(); }); @@ -109,8 +109,8 @@ // Check if we have array of close buttons if ($.isArray(closeObj)) { - for (var i = 0, len = closeObj.length; i < len; i++) { - closeObj[i].on("click", function (e) { + for (var v = 0, closeLen = closeObj.length; v < closeLen; v++) { + $(closeObj[v]).on("click", function (e) { e.preventDefault(); closePopLiteModal(); }); @@ -134,7 +134,7 @@ obj.bind('closePopLiteModal', function () { closePopLiteModal(); - }) + }); //if mask is clicked @@ -147,7 +147,7 @@ } $(window).resize(function () { if (isOpen) { - resizeWindow(); + resizeBox(); } }); }); From f3a7f73fc09b9a038d0835092a154fbd0c0f3c2d Mon Sep 17 00:00:00 2001 From: razmig Date: Tue, 18 Feb 2014 22:15:55 +0100 Subject: [PATCH 05/12] minify --- modalPopLite.min.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/modalPopLite.min.js b/modalPopLite.min.js index 37733bb..d2a1b0b 100644 --- a/modalPopLite.min.js +++ b/modalPopLite.min.js @@ -1 +1,32 @@ -(function(e){var t=0;e.fn.modalPopLite=function(n){var n=e.extend({},{openButton:"modalPopLite-open-btn",closeButton:"modalPopLite-close-btn",isModal:false,callBack:null},n);return this.each(function(){t++;var r=t;var i=false;var s=e(this);var o=n.openButton;var u=n.closeButton;var a=n.isModal;s.before('
');s.wrap('
');s.addClass("modalPopLite-child-"+r);e(o).on("click",function(t){t.preventDefault();var n=e(window).width();var s=e(window).height();var o=e(".modalPopLite-child-"+r).outerWidth();var u=e(".modalPopLite-child-"+r).outerHeight();var a=n/2-o/2;var f=s/2-u/2;e("#modalPopLite-mask"+r).css("height",s+"px");e("#modalPopLite-mask"+r).fadeTo("slow",.6);e("#modalPopLite-wrapper"+r).css({left:a+"px",top:f});e("#modalPopLite-wrapper"+r).fadeIn("slow");i=true});e(u).on("click",function(t){t.preventDefault();e("#modalPopLite-mask"+r).hide();e("#modalPopLite-wrapper"+r).css("left","-10000px");i=false;if(n.callBack!=null){n.callBack.call(this)}});if(!a){e("#modalPopLite-mask"+r).click(function(t){t.preventDefault();e(this).hide();e("#modalPopLite-wrapper"+r).css("left","-10000px");i=false;if(n.callBack!=null){n.callBack.call(this)}})}e(window).resize(function(){if(i){var t=e(window).width();var n=e(window).height();var s=e(".modalPopLite-child-"+r).outerWidth();var o=e(".modalPopLite-child-"+r).outerHeight();var u=t/2-s/2;var a=n/2-o/2;e("#modalPopLite-wrapper"+r).css({left:u+"px",top:a});e("#modalPopLite-mask"+r).css("height",n+"px")}})})};e.fn.modalPopLite.Close=function(t){e("#modalPopLite-mask"+t).hide();e("#modalPopLite-wrapper"+thisPopID).css("left","-10000px");if(options.callBack!=null){options.callBack.call(this)}};e.fn.modalPopLite.ShowProgress=function(){e('
').appendTo("body")};e.fn.modalPopLite.HideProgress=function(){e(".popBox-ajax-progress").remove()}})(jQuery) \ No newline at end of file +/* +* jQuery modalPopLite +* Copyright (c) 2012 Simon Hibbard +* +* Permission is hereby granted, free of charge, to any person +* obtaining a copy of this software and associated documentation +* files (the "Software"), to deal in the Software without +* restriction, including without limitation the rights to use, +* copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following +* conditions: + +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* +* Version: V1.3.2 +* Release: 10-01-2013 +* Based on jQuery from 1.7 to 1.11.0 / 2.1.0 +*/ +(function($,window){var popID=0,modalPopLite_mask="#modalPopLite-mask",modalPopLite_wrapper="#modalPopLite-wrapper";$.fn.modalPopLite=function(settings){var options=$.extend({},{openButton:"modalPopLite-open-btn",closeButton:"modalPopLite-close-btn",isModal:false,openCallback:null,closeCallback:null},settings);return this.each(function(){popID++;var thisPopID=popID,isOpen=false,obj=$(this),openObj=options.openButton,closeObj=options.closeButton,isReallyModel=options.isModal,openCallback=options.openCallback,closeCallback=options.closeCallback,resizeBox=function(){var winW=$(window).width(),winH=$(window).height(),objW=$(".modalPopLite-child-"+thisPopID).outerWidth(),objH=$(".modalPopLite-child-"+thisPopID).outerHeight(),left=winW/2-objW/2,top=winH/2-objH/2;$(modalPopLite_wrapper+thisPopID).css({left:left+"px",top:top});$(modalPopLite_mask+thisPopID).css("height",winH+"px")},openPopLiteModal=function(){resizeBox();$(modalPopLite_mask+thisPopID).fadeTo("slow",.6);$(modalPopLite_wrapper+thisPopID).fadeIn("slow");isOpen=true;if(typeof openCallback==="function"){openCallback()}},closePopLiteModal=function(){$(modalPopLite_mask+thisPopID).hide();$(modalPopLite_wrapper+thisPopID).css("left","-10000px");isOpen=false;if(typeof closeCallback==="function"){closeCallback()}};obj.before('
');obj.wrap('
');obj.addClass("modalPopLite-child-"+thisPopID);if($.isArray(openObj)){for(var i=0,len=openObj.length;i Date: Tue, 18 Feb 2014 22:35:19 +0100 Subject: [PATCH 06/12] update version, remove gif and update readme file --- README.txt | 43 ++++++++++++++++++++++++++++++++++++++++--- ajax-loader.gif | Bin 6820 -> 0 bytes modalPopLite.js | 4 ++-- 3 files changed, 42 insertions(+), 5 deletions(-) delete mode 100644 ajax-loader.gif diff --git a/README.txt b/README.txt index ad42206..b9642b5 100644 --- a/README.txt +++ b/README.txt @@ -1,6 +1,43 @@ -This is a super simple and lightweight jQuery Modal Popup dialog box. +Original repo and How to Page +============================== -How to guide can be found here: http://www.mywebdeveloperblog.com/my-jquery-plugins/modalpoplite +https://github.com/shibbard/jQuery-modalPopLite -Demo can be found here: http://www.mywebdeveloperblog.com/projects/modalpoplite/demo/ +http://www.mywebdeveloperblog.com/my-jquery-plugins/modalpoplite + +New Updates +-------------- + +1- **openCallback:** Function will be called after the Modal has been opened + +2- **closeCallback:** Function will be called after the Modal has been closed + +3- **$(elem).on('openPopLiteModal'):** Trigger open ModalPolite + +4- **$(elem).on('closePopLiteModal'):** Trigger close ModalPolite + +5- **openButton:** String or Array of open buttons + +6- **closeButton:** String or Array of close buttons + +7- **isModal** – true or false. If true the popup is modal and clicking the background will not close the popup. Only the ‘closeButton’ target will. + + +Usage +=============== + +Step 1: Include files +---------------------- + + + + + + +Step 2: Create the page with an element to click and open the popup and a close button. +---------------------------------------------------------------------------------------- + +
Click Me!
+ diff --git a/ajax-loader.gif b/ajax-loader.gif deleted file mode 100644 index 8059cbf9cb2f72c666bcb87b74d75c884d545cf2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6820 zcmaKxS5#Box`smz1N_Kq4!P@q*v*^gBp5h(mPV5DS}j`h)9uM1VKPR z1VNghh=ACB4!Zxn&lzW*edfiwSaYnkZl3YH-#eGOrW#((P6?m{_yYL7b^*zi0Q)e2 z1}6Y<6(9)#fTjQuvH;wl&HsJD{e@QcbFvF?a>NF^2Do7D-0VU;yzLxCT)mvV0l05q z0QK1;xKkQERTE=nMFUj{5itr1{{f31;lcDYGwfwvpIxNAl24 z;C0HOTwN};TksR=5iEj>q0FQztet$|X0RTddN851Aluy8L>wMsq^AXk0J50`P%E)< zm!K()*YCJoAU~rAK0O{$4zhCMKyCV#3udiyALj$XCRwj8jKkWy@8vD_Cy{^wi_#w&GFHjwQ zJqUi?i8&GLk;NNLST zeJl3xX9cuoLk5gdNvu=_ief9dnTeQFjFOxh0XM||L$AhixT#Y63ea9Af$dA>`DDCY zn1>%WeY^FZe!rmrQq>QEWAj}2Ui>ax}POWOgF^a zzqrYlKWjUJf%EqYva!6X$eYRHA`a>C&OSb^(6fU15{z=7;7oTn_vzK^-u=UGW_%Ce zAjrXY@yXBZ3S)ulfzSw0i!-hW60$sPHexiJui4C&((8k|KYudH07)Iw%Q=Z?zJT&?Fv8~imtbvxkV%Z}@z?7_%s^~*7DQKyT*(t(C z80u+tXLg%tC4RImtbMXNiZm~Ke8IN+8&$G@mj_Z^)8ZVHx{tf*%`lKtd;k+y5();) z0;tD{g7SnMQp2R}NWlniyfL~8z#pSX#__n^H*s`>mB~UOsqQU`HLc00>)lHJeb3!^ zM(k>eM@bzV5bh4>)F_~x1qubv)KQ`r7UjTTSgk0U612OCS=nCYoV9#+P<^=low;*l zudsDunJ(~j{f0Kap{zKBKKk<{)|Nm)X55^z;4SM0B%)7OoOT<0t$J8t3UQcWoK=rE zJIvBCfdZpkfcM{78g7o(N@EV!QX;f$b(CON_f4*6@u`&=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<*{IL9P8v!+8Pr_hnXJFH)+r-eYJ-xh)@OY z^=F}tw%0;~s9>`%_Q`({Dvq_Ee?=fE0CB-2$mCSavgh2LtbF44{|1Hn-$BWO|JF*G zIn4fVP?*E2Jn0gph;fx}r+}%1mBJwjn3)>Y^Ug$sa#NGCMD#13&FzCzPjVI@Lkl$E{?#SevRn|$v-Y6enz)#DlyC_$CBPjQu8nW)5ENWU&0WEcg@ zP0E_EfKAmfLtX*f<`uzlLZ|^-ydf(1}$eHJ(Lw^4Mi@ZX2a~;kbciAi3o#?Cs0_^}Pw8 zsaROrFZBEKV-Cu<`n#M@IBr~zMBD4W60alvA zqtf}rRMZp{r^2PB77s28rK?@mMmvMe!x1o$JAlMS8O+M(5|^Bb2NA<=Bntsl9jMSq@74*G&40u@KA}?| z^vou0wzK0I09FNDc{9^7!n6q5-Uzy@$O+9~+Q7t3%7UklQMtbWmr>L(+FY?=}6TZu#AZ1Ll&Q8LdO3adj?MhVBTs7|gqY2^9_vXR;fl)xbzXFm} z!AnaN^QL|k(o}WUgfg2LuVoVBZ-BzCQ58s*#E^+K29_FPS$aj1Ax7)DGkSXBmZ@ly zL>HSUUS-S0WP#FqPj4{1uSyuo-0e4@Vt&jt=s%_1Z7a857moa-Ow0I7f##mX`!yEu z-G#jjbBX%iFyF~uwgt{DQVSyIp@G|noL9A)RmVkZhe!(VI6gO-b3rP7Y$3f929CNr z;}{jKT-Cax?p;@2mTgzM#sv;;CJnOUH>{e_T%DLMJXa&TW$| zH9knctLiH;5?4vzu{L2cJ1uT8HVgLXD diff --git a/modalPopLite.js b/modalPopLite.js index 3b30232..01427b4 100644 --- a/modalPopLite.js +++ b/modalPopLite.js @@ -25,8 +25,8 @@ */ /* -* Version: V1.3.2 -* Release: 10-01-2013 +* Version: V1.4 +* Release: 20-02-2014 * Based on jQuery from 1.7 to 1.11.0 / 2.1.0 */ From e5ddfc0a93b3e81480e2098669d30284f6350f91 Mon Sep 17 00:00:00 2001 From: razmig Date: Tue, 18 Feb 2014 22:36:31 +0100 Subject: [PATCH 07/12] rename readme file --- README.txt => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.txt => README.md (100%) diff --git a/README.txt b/README.md similarity index 100% rename from README.txt rename to README.md From 84a1c3ad07c97e1a8ea8c4dfc2956817b233e756 Mon Sep 17 00:00:00 2001 From: razmig Date: Tue, 18 Feb 2014 22:39:53 +0100 Subject: [PATCH 08/12] update readme --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b9642b5..6c7a55b 100644 --- a/README.md +++ b/README.md @@ -30,14 +30,14 @@ Usage Step 1: Include files ---------------------- - - - + + + Step 2: Create the page with an element to click and open the popup and a close button. ---------------------------------------------------------------------------------------- -
Click Me!
- +
Click Me!
+ From 44a821027f566d8336245bfb5928df9567e6ee62 Mon Sep 17 00:00:00 2001 From: razmig Date: Tue, 18 Feb 2014 22:43:25 +0100 Subject: [PATCH 09/12] update readme --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 6c7a55b..65d8493 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,15 @@ Step 2: Create the page with an element to click and open the popup and a close
Click Me!
+ +Step 3: Attach the popup to a container on the page. +---------------------------------------------------- + + From 31e184ed490c693f422f5fbc3f3c2728521151a0 Mon Sep 17 00:00:00 2001 From: razmig Date: Tue, 18 Feb 2014 22:53:38 +0100 Subject: [PATCH 10/12] fix callback bug --- modalPopLite.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modalPopLite.js b/modalPopLite.js index 01427b4..9be068f 100644 --- a/modalPopLite.js +++ b/modalPopLite.js @@ -74,7 +74,7 @@ isOpen = true; if (typeof openCallback === 'function') { - openCallback(); + openCallback.call(this); } }, closePopLiteModal = function () { @@ -84,7 +84,7 @@ isOpen = false; if (typeof closeCallback === 'function') { - closeCallback(); + closeCallback.call(this); } }; From e6c2bf8d509fc457922e6a6d76eb2603a8a5da4e Mon Sep 17 00:00:00 2001 From: razmig Date: Tue, 18 Feb 2014 22:54:42 +0100 Subject: [PATCH 11/12] update min file --- modalPopLite.min.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modalPopLite.min.js b/modalPopLite.min.js index d2a1b0b..7958b17 100644 --- a/modalPopLite.min.js +++ b/modalPopLite.min.js @@ -25,8 +25,9 @@ */ /* -* Version: V1.3.2 -* Release: 10-01-2013 +* Version: V1.4 +* Release: 20-02-2014 * Based on jQuery from 1.7 to 1.11.0 / 2.1.0 */ -(function($,window){var popID=0,modalPopLite_mask="#modalPopLite-mask",modalPopLite_wrapper="#modalPopLite-wrapper";$.fn.modalPopLite=function(settings){var options=$.extend({},{openButton:"modalPopLite-open-btn",closeButton:"modalPopLite-close-btn",isModal:false,openCallback:null,closeCallback:null},settings);return this.each(function(){popID++;var thisPopID=popID,isOpen=false,obj=$(this),openObj=options.openButton,closeObj=options.closeButton,isReallyModel=options.isModal,openCallback=options.openCallback,closeCallback=options.closeCallback,resizeBox=function(){var winW=$(window).width(),winH=$(window).height(),objW=$(".modalPopLite-child-"+thisPopID).outerWidth(),objH=$(".modalPopLite-child-"+thisPopID).outerHeight(),left=winW/2-objW/2,top=winH/2-objH/2;$(modalPopLite_wrapper+thisPopID).css({left:left+"px",top:top});$(modalPopLite_mask+thisPopID).css("height",winH+"px")},openPopLiteModal=function(){resizeBox();$(modalPopLite_mask+thisPopID).fadeTo("slow",.6);$(modalPopLite_wrapper+thisPopID).fadeIn("slow");isOpen=true;if(typeof openCallback==="function"){openCallback()}},closePopLiteModal=function(){$(modalPopLite_mask+thisPopID).hide();$(modalPopLite_wrapper+thisPopID).css("left","-10000px");isOpen=false;if(typeof closeCallback==="function"){closeCallback()}};obj.before('
');obj.wrap('
');obj.addClass("modalPopLite-child-"+thisPopID);if($.isArray(openObj)){for(var i=0,len=openObj.length;i');obj.wrap('
');obj.addClass("modalPopLite-child-"+thisPopID);if($.isArray(openObj)){for(var i=0,len=openObj.length;i Date: Thu, 20 Feb 2014 09:56:17 +0100 Subject: [PATCH 12/12] bind events to dynamically loaded elements --- modalPopLite.js | 64 ++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/modalPopLite.js b/modalPopLite.js index 9be068f..3c7ecd0 100644 --- a/modalPopLite.js +++ b/modalPopLite.js @@ -1,7 +1,7 @@ /* * jQuery modalPopLite * Copyright (c) 2012 Simon Hibbard -* +* * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without @@ -13,7 +13,7 @@ * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. -* +* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -21,7 +21,7 @@ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. +* OTHER DEALINGS IN THE SOFTWARE. */ /* @@ -67,25 +67,31 @@ $(modalPopLite_wrapper + thisPopID).css({ 'left': left + "px", 'top': top }); $(modalPopLite_mask + thisPopID).css('height', winH + "px"); }, - openPopLiteModal = function () { - resizeBox(); - $(modalPopLite_mask + thisPopID).fadeTo('slow', 0.6); - $(modalPopLite_wrapper + thisPopID).fadeIn('slow'); - isOpen = true; - - if (typeof openCallback === 'function') { - openCallback.call(this); - } + openPopLiteModal = function (btn) { + $(document).on("click", btn, function (e) { + e.preventDefault(); + resizeBox(); + $(modalPopLite_mask + thisPopID).fadeTo('slow', 0.6); + $(modalPopLite_wrapper + thisPopID).fadeIn('slow'); + isOpen = true; + + if (typeof openCallback === 'function') { + openCallback.call(this); + } + }); }, - closePopLiteModal = function () { - $(modalPopLite_mask + thisPopID).hide(); - $(modalPopLite_wrapper + thisPopID).css('left', "-10000px"); + closePopLiteModal = function (btn) { + $(document).on("click", btn, function (e) { + e.preventDefault(); + $(modalPopLite_mask + thisPopID).hide(); + $(modalPopLite_wrapper + thisPopID).css('left', "-10000px"); - isOpen = false; + isOpen = false; - if (typeof closeCallback === 'function') { - closeCallback.call(this); - } + if (typeof closeCallback === 'function') { + closeCallback.call(this); + } + }); }; obj.before('
'); @@ -95,31 +101,19 @@ // Check if we have array of open buttons if ($.isArray(openObj)) { for (var i = 0, len = openObj.length; i < len; i++) { - $(openObj[i]).on("click", function (e) { - e.preventDefault(); - openPopLiteModal(); - }); + openPopLiteModal(openObj[i]); } } else { - $(openObj).on("click", function (e) { - e.preventDefault(); - openPopLiteModal(); - }); + openPopLiteModal(openObj); } // Check if we have array of close buttons if ($.isArray(closeObj)) { for (var v = 0, closeLen = closeObj.length; v < closeLen; v++) { - $(closeObj[v]).on("click", function (e) { - e.preventDefault(); - closePopLiteModal(); - }); + closePopLiteModal(closeObj[v]); } } else { - $(closeObj).on("click", function (e) { - e.preventDefault(); - closePopLiteModal(); - }); + closePopLiteModal(closeObj); } // Bind an event listener on object to trigger open without need to