Hi there and thanks for contributing to this article!
That looks awesome rewritten in jQuery! I'm pretty sure people will find it very interesting. And for people that don't/can't use a framework, this example still remains relevant.
I would also like to add that you can go even further by using jQuery everywhere in this slightly updated example.
functiononRouteChanged(){consthash=window.location.hash;constrouterView=$("#router-view");// updatedif(!(routerViewinstanceofHTMLElement)){thrownewReferenceError("No router view element available for rendering");}switch(hash){case"#home"://routerView.innerHTML = "<h1>Home page</h1>";routerView.load('views/home.html');// updatedbreak;case"#about"://routerView.innerHTML = "<h1>About page</h1>";routerView.load('views/about.html');// updatedbreak;default://routerView.innerHTML = "<h1>404 - Page Not Found</h1>";routerView.load('views/404.html');// updatedbreak;}}$(window).on("hashchange",onRouteChanged);// updated
Except styles don't apply to the <object> tag sadly and I think it would be very inconvenient to style elements using this technique and an external CSS file.
But if you are designing a markup-only web page this is the way to go (or use inline styles if you are brave enough).
But this is a great tag to render some multimedia content like videos or PDF files!
Hi there and thanks for contributing to this article!
That looks awesome rewritten in jQuery! I'm pretty sure people will find it very interesting. And for people that don't/can't use a framework, this example still remains relevant.
I would also like to add that you can go even further by using jQuery everywhere in this slightly updated example.
Without jQuery lol
replit.com/@TangoPJ/CarefreeSlateg...
That's really clever, well done!
Except styles don't apply to the
<object>tag sadly and I think it would be very inconvenient to style elements using this technique and an external CSS file.But if you are designing a markup-only web page this is the way to go (or use inline styles if you are brave enough).
But this is a great tag to render some multimedia content like videos or PDF files!
Yep, I have a problem with styling my content, I think how can I do that now. Thank you for your return