/** * Created with JetBrains PhpStorm. * User: robi * Date: 25/08/2013 * Time: 21:04 * To change this template use File | Settings | File Templates. */ jQuery(function($) { //$("a.topopup").hover(function() { // loading(); // loading // setTimeout(function(){ // then show popup, deley in .5 second // loadPopup(); // function show popup // }, 500); // .5 second // return false; //}); $("div.close").click(function() { disablePopup(); // function close pop up }); $(this).keyup(function(event) { if (event.which == 27) { // 27 is 'Ecs' in the keyboard disablePopup(); // function close pop up } }); $("div#backgroundPopup").click(function() { disablePopup(); // function close pop up }); }); // jQuery End function loading() { $("div.loader").show(); } function closeloading() { $("div.loader").hide(); } var popupStatus = 0; // set value function loadPopup() { if(popupStatus == 0) { // if value is 0, show popup closeloading(); // fadeout loading $("#toPopup").fadeIn("normal"); // fadein popup div $("#backgroundPopup").show(); popupStatus = 1; // and set value to 1 } } function disablePopup() { if(popupStatus == 1) { // if value is 1, close popup $("#toPopup").fadeOut("normal"); $("#backgroundPopup").hide(); popupStatus = 0; // and set value to 0 } } function loadRingDetails(rType) { $.ajax({ url: 'system/ringinfo/getinfo/ringType/'+rType, async: false, dataType: 'json', data: null, success: function (data) { $('#popup_content').html(data.content); } }); } function popUpInfo(ringType) { loading(); // loading setTimeout(function(){ // then show popup, deley in .5 second loadPopup(); // function show popup loadRingDetails(ringType); }, 500); // .5 second return false; };