Personalized checkout and custom promotions with Shopify Scripts
Hello this is Sneh.
I am having issues while adding a simple html css modal to the theme.liquid file.
How can I add this on my website?
This is the html code:
<script type="text/javascript">
// Removes the HTML dag div with the class popup from javascript using in-built html-JS methods
function myFunction() {
document.getElementById("cls1").innerHTML = "";
}
</script>
<div id="cls1">
<div class="popup">
<h2>Pop-up name here</h2>
<button class="close" onclick="myFunction()">×</button>
<div class="content">
Pop-Up text here.
</div>
</div>
</div>
.popup {
padding: 55px;
background: #72C6D5;
border-radius: 5px;
width: 30%;
position: fixed;
bottom: 0;
right: 0;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
@media screen and (max-width: 700px){
.box{
width: 70%;
}
.popup{
width: 70%;
}
}
This is the css:
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025