(function($){ // Defining our jQuery plugin $.fn.twistModalBox = function(prop){ // Default parameters var options = $.extend({ windowContent: "", windowTitle: "", description: "", left: "20%", position: "fixed", title:"", top: "5%", width: "90%;", },prop); $('#twistModalBox').remove(); add_block_page(); add_popup_box(); add_styles(); $('body').css({ }); $('.twistModalBox').fadeIn(); //$('.twistModalBox').draggable(); /* Add styles to the html markup */ function add_styles(){ $('.twistModalBox').css({ 'background': '#f2f2f2', 'border':'1px solid #fff', 'border-radius':'5px', '-moz-border-radius':'5px', '-webkit-border-radius':'5px', 'box-shadow': '0px 2px 7px #292929', '-moz-box-shadow': '0px 2px 7px #292929', '-webkit-box-shadow': '0px 2px 7px #292929', 'display':'block', //'height':'600px', 'font-weight':'bold', 'left':options.left, 'min-height': options.height + 'px', 'min-width': options.width + 'px', 'position':'absolute', 'top':options.top, 'z-index':'2000', }); $('.twist_modal_close').css({ 'background': 'url(https://www.twistwebsite.com/thirdParty/themify-icons/SVG/close.svg) no-repeat', 'display':'block', 'float':'right', 'height':'24px', 'left':'0px', 'position':'relative', 'top':'0px', 'width':'24px', 'z-index':'2100', }); $('.twistModalVeil').css({ 'background-color':'rgba(0,0,0,0.5)', 'height':'100%', 'left':'0', 'position':'fixed', 'top':'0', 'width':'100%', 'z-index':'1000' }); $('.twist_inner_modal_box').css({ 'background-color':'#fff', 'border-radius':'5px', '-moz-border-radius':'5px', '-webkit-border-radius':'5px', 'display':'block', 'height':(options.height-100)+'px', 'margin-top':10 + 'px', 'overflow':'auto', 'padding':'10px', 'position':'relative', 'left':'10px', 'top':'10', 'width':(options.width-40) + 'px', }); } /* Create the block page div */ function add_block_page(){ var block_page = $('
'); $(block_page).appendTo('body'); } /* Creates the modal window */ function add_popup_box(){ var pop_up = $('
' + options.windowTitle + '

' + options.description + options.windowContent + '

'); $(pop_up).appendTo('.twistModalVeil'); $('.twist_modal_close').click(function(){ if (!$('#twistModalWindowExitURL').val()=='') { if ($('#twistModalWindowExitURL').val()=='reload') { window.location.reload(true); } else { window.location.href=$('#twistModalWindowExitURL').val(); } } $(this).parent().fadeOut().remove(); $('.twistModalVeil').fadeOut().remove(); $('body').css({ 'overflow':'visible', }); }); } return this; }; })(jQuery);