0
Summary: Personal I am wanting to make a modification in the site of the company where I work and do not know how to do it.
PROBLEM: I would like to create a form in Javascript that as it changes page was changing as soon as it is located at the top/center of the site using Javascript or even CSS if possible.
Technologies Used in this project: ASP.NET CORE MVC, HTML, CSS, Javascript.
Code of the part that is the logo:
<div id="header">
<a href="/" title="Sport Club Corinthians Paulista" class="header-logo" onclick="ga('send', 'event', 'Links', 'click', 'Home');" style="
height: 148px;width: 122px;position: absolute;top: 50%;-webkit-transform: translateY(-50%);transform: translateY(-50%);left: 50%;-webkit-transform: translate(-50%, -50%);transform: translate(-50%, -50%);height: 50px;z-index: 2;">
<span class="ct-logo">
<img class="logo" src="https://dnxstorage.blob.core.windows.net/dnx/publico/FundoTransparente.png" title="DNX Soluções Tecnológicas" alt="DNX Soluções Tecnológicas">
</span>
</a>
<div>
...
It would not just be the case to change the img src?
– Felipe Avelar
So my friend is that as it is in ASP this part stays in the layout what replicates in all pages. I would like something with more dynamism than when the user clicked on who we are for example the logo that is located in the Shared layout view was updated to the destination page change the logo. If on each page there was a specific part for the logo I could do what you told me, more like it’s a parent view code for several daughters view then I can’t do it this way.
– Thiago Correa
So it wouldn’t be the case to put an id on the logo and execute the command
document.getElementById(idDaLogo).src = novoSrc;
in js when the page loads?– Felipe Avelar