Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
2174 มุมมอง

How can I create a website popup that displays in all pages maybe on the header without redirecting to a page in odoo 12?





อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

Update your HTML to include a menu item or button that will trigger the popup when clicked

<!DOCTYPE html>
<html>
<head>
    
<!-- Your other head content here -->
</head>
<body>
    <header>
        
<!-- Your website header content here -->

        
<!-- Popup container -->
        <div id="popup" class="popup">
            <span class="popup-content">This is your popup content.</span>
            <button id="closePopup" class="close-button">Close</button>
        </div>
    </header>

    
<!-- Your website menu -->
    <nav>
        <ul>
            <li><a id="showPopupButton" href="#">Show Popup</a></li>
            
<!-- Other menu items -->
        </ul>
    </nav>

    
<!-- The rest of your website content here -->

    <script src="popup.js"></script>
</body>
</html>




Modify the JavaScript code to display the popup when the menu item is clicked.

document.addEventListener("DOMContentLoaded", function () {
const popup = document.getElementById("popup");
const closePopupButton = document.getElementById("closePopup");
const showPopupButton = document.getElementById("showPopupButton");

function openPopup() {
    popup.style.display = "block";
}

function closePopup() {
    popup.style.display = "none";
}

showPopupButton.addEventListener("click", openPopup);
closePopupButton.addEventListener("click", closePopup);
});


Hope it helps

อวตาร
ละทิ้ง
ผู้เขียน

Thank you for your response. How can I do this in odoo 12. Sorry I didn't specify it was for odoo 12 earlier

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 16
7816
2
ธ.ค. 22
6191
1
มิ.ย. 21
11587
0
ธ.ค. 24
1224
0
พ.ย. 24
1443