Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Auto start jQuery function

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #32118

    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

    #53464

    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();
    }
    });

    });
    #53428
    guiniveretoo
    Member

    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();
    }
    });

    });
    #53420

    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();
    });
    #53422
    guiniveretoo
    Member

    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. :/

    #53423

    Nevermind! I see I had to move the brackets out to include all.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.