I’ve been trying to add some javascript to hide the logo header for a specific scene, with no success.
This is possible to do via CSS but only for all pages. And before Knack introduced the new header theme a couple months ago it was also possible to do it via Javascript for a specific scene. Was anyone able to?
Here is the code that I would think should work, but doesn’t:
Thank you Brad for testing it out. I finally found the reason for this issue. It seems like that javascript code is only triggered when there’s a table or list in the page. In my case I had just text and a menu. And it seems like that doesn’t make the javascript execute. It also doesn’t seem to work if the page only has a form. Strange, not sure if it’s a bug…
That was actually a good idea, thank you! But surprisingly the same thing happens.
I tried a page with a menu and a table, and linked the javascript to the menu. It works as expected. But as soon as I delete the table, the code stops triggering. If then I add a list or a table the code starts to work again.
I reached Knack Support about this, but it seems like it’s out of their scope to look at issues with custom code.
I have a couple of pages (including a login and registration) that I need to change the logo, but have tried extensively to remove or change the logo - but as MGR says if you have no forms etc javascript won’t run - and despite spending hours in CSS to try and stop the logo displaying no avail. I know i could add a blank table and then hide it in css, but I know in 6 mnths time i’ll have no idea why there is a blank table on the screen and delete it lol!
I think I can help here as I kinda crossed this issue when writing this below. I think what’s happening here is the wrong event listener is being used. I think @BradStevens probably had the best approach.
In the post the issue was targeting only the log in pages. So I wrote in javascript if the log in section exists then add or removed a class routed the body and scene. I also used the page render event which works only for what you need.
You now can use .loginPage specify your target just to the log in page