When user clicks the button,following things should happen:
- Page will reload
- Run some javascript code
This is my code of JavaScript:
location.reload() == jQuery(function($) {
$("div.ProductCheckout").click(function($) {
loading(); // loading
$(window).load(function() {
setTimeout.fadeOut(2000, 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
}
});
$('a.livebox').click(function() {
alert('Hello World!');
return false;
});
function loading() {
$("div.loader").show();
}
function closeloading() {
$("div.loader").fadeOut('normal');
}
var popupStatus = 0; // set value
function loadPopup() {
if (popupStatus == 0) { // if value is 0, show popup
closeloading(); // fadeout loading
$("#ProductCheckout").fadeIn(0500); // fadein popup div
$("#backgroundPopup").css("opacity", "0.7"); // css opacity, supports IE7, IE8
$("#backgroundPopup").fadeIn(0001);
popupStatus = 1; // and set value to 1
}
}
function disablePopup() {
if (popupStatus == 1) { // if value is 1, close popup
$("#ProductCheckout").fadeOut("normal");
$("#backgroundPopup").fadeOut("normal");
popupStatus = 0; // and set value to 0
}
}
});
any help will be appreciated.
For clearance I just want to run this javascript
code when page is completely reloaded.