I'm not confident in my CSS/HTML/jQuery skills but I believe what I want to achieve may require JavaScript/jQuery. I want to apply a specific style to an element only when a certain URL is accessed on my website.
Since I am using ASP.NET and one template handles multiple URLs, adding the style directly into the HTML of the template isn't feasible. If I include the style in a CSS file and link it to the template, it will affect all URLs.
I could load the CSS file selectively with jQuery, but I prefer to minimize the use of jQuery as much as possible.
Another option would be to use an ASP.NET literal control
to dynamically load the CSS based on the URL from the code-behind. However, this approach could get messy and require code changes every time a new URL is added.
Currently, I'm achieving this functionality using JavaScript/jQuery on document.ready
event, but the element briefly appears before disappearing.
If there's a solution that involves jQuery or JavaScript and resolves the flickering issue, I'd greatly appreciate it.
I hope I've explained my dilemma clearly. Please feel free to ask for any clarifications if needed.