- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Auto start jQuery function
I would like this pop-up to appear when the page loads. I don’t want for a button to be pushed or any action like that.
Is there like an auto run action?
http://goodwynbuilding.com/test/
$("#button").click(function(){
//centering with css
centerPopup();
//load popup
loadPopup();
});
Thanks
I already have that.
$(document).ready(function(){
//LOADING POPUP
//Click the button event!
$("#button").click(function(){
//centering with css
centerPopup();
//load popup
loadPopup();
});
//CLOSING POPUP
//Click the x event!
$("#popupContactClose").click(function(){
disablePopup();
});
//Click out event!
$("#backgroundPopup").click(function(){
disablePopup();
});
//Press Escape event!
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
disablePopup();
}
});
});
Try taking out the first button click:
$(document).ready(function(){
//centering with css
centerPopup();
//load popup
loadPopup();
//CLOSING POPUP
//Click the x event!
$("#popupContactClose").click(function(){
disablePopup();
});
//Click out event!
$("#backgroundPopup").click(function(){
disablePopup();
});
//Press Escape event!
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
disablePopup();
}
});
});
Thanks that worked, but now I cant figure out why it has disabled these two…
$("#popupContactClose").click(function(){
disablePopup();
});
//Click out event!
$("#backgroundPopup").click(function(){
disablePopup();
});
not sure. Are you using a plugin? It might assign id’s to objects on the first click, so now the id’s aren’t being assigned because there’s no initial “click” action. Really am guessing on this on though. :/
Nevermind! I see I had to move the brackets out to include all.