[Solved] The easiest way to automatically open a popup? [closed]


I would normally use a jQuery UI dialog, but if you want something simpler, here you go:

If this is your html div:

<div id="popup">
    <h1>Welcome</h1> 
    <span id="closePopup">Close</span>
</div>

And this is your CSS (positioning of pop up may not be perfect, this is rough):

#popup{
    display:none;
    position:absolute;
    top:150px;
    width:50%;
    left:25%;
}
#popupClose{
    cursor:pointer;
    text-decoration:underline;
}

Then this is your javascript(jquery):

$(document).ready(function(){
    $('#popup').show(); //show the pop up on page load
    $('#popupClose').click(function(){  //when the user clicks on the word close
        $('#popup').close();  //close the pop up
    });
});

1

solved The easiest way to automatically open a popup? [closed]