Popups
I have a client that needs a jpg to popup on the home page five seconds after it loads. Anyone have suggested code I can use to accomplish this? Dreamweaver CC 2018.
I have a client that needs a jpg to popup on the home page five seconds after it loads. Anyone have suggested code I can use to accomplish this? Dreamweaver CC 2018.
Any good with code? You can use the setTimeOut function in javascript - example below will provide you a solution:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pop Up</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script>
$(document).ready(function(){
$('.pop_up').hide();
setTimeout(function(){
$('.pop_up').fadeIn();
}, 5000);
$('.close_pop_up').css('cursor' , 'pointer').click(function(){
$('.pop_up').fadeOut();
});
});
</script>
<style>
body {
margin: 0;
}
.pop_up {
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);)
}
.pop_up_content {
width: 300px;
margin: 0 auto;
text-align: center;
padding: 25px;
background-color: #fff;
position: relative;
top: 50%;
transform: translateY(-50%);
}
</style>
</head>
<body>
<div class="pop_up">
<div class="pop_up_content">
<h1>Pop Up</h1>
<button class="close_pop_up">Close</button>
</div>
<!-- endpop_up_content -->
</div>
<!-- end pop_up -->
</body>
</html>
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.