Estoy tratando de hacer que mi logotipo aparezca en mi encabezado cuando me desplazo hacia abajo. Funciona normalmente en una página html simple pero no funciona en el sitio web de Odoo.
En el sitio web de odoo coloqué mi archivo JS así en assets.xml:
<template id="assets_editor" name="Vichysport's Script" inherit_id="website.assets_editor" priority="1"> <xpath expr="script[last()]" position="after"> <script type="text/javascript" src="/vichysport/static/js/template.js"/> </xpath> </template>Mi manifiesto está bien y llamo a mi layout.xml y mis assets.xml
Realmente no entiendo por qué no funciona... pero aquí hay un ejemplo de mi código.
<!DOCTYPE html> <html> <head> <style> #LogoSvg { opacity: 0; position: fixed; margin: 1% auto; /* Will not center vertically and won't work in IE6/7. */ left: 0; right: 0; } </style> <script> window.onscroll = function() {hideornot()}; function hideornot() { if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) { document.getElementById("LogoSvg").style.opacity = "100%"; } else { document.getElementById("LogoSvg").style.opacity = "0%"; } } </script> </head> <body style="height:1500px"> <p>Scroll down this page</p> <svg id="LogoSvg" xmlns="http://www.w3.org/2000/svg" width="83.999" height="84" viewBox="0 0 83.999 84"> <g id="Groupe_9299" data-name="Groupe 9299" transform="translate(549.139 66.665)"> <rect id="Rectangle_2908" data-name="Rectangle 2908" width="27.998" height="28.001" transform="translate(-549.139 -66.665)" fill="#0e3144"></rect> <rect id="Rectangle_2909" data-name="Rectangle 2909" width="27.998" height="28.001" transform="translate(-493.14 -66.665)" fill="#0e3144"></rect> <rect id="Rectangle_2910" data-name="Rectangle 2910" width="27.998" height="27.998" transform="translate(-549.139 -10.663)" fill="#0e3144"></rect> <rect id="Rectangle_2911" data-name="Rectangle 2911" width="27.998" height="27.998" transform="translate(-493.14 -10.666)" fill="#0e3144"></rect> </g> </svg> </body> </html>¿Alguien puede ayudarme a entender por qué? Gracias