Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jquery css change Re: jquery css change

#49234
Jeager
Member

Well, found a way of doing it..





Kind of a loophole, @import loads the normal css.css file, while the link href=”homebg.css” loads the bg image for the homepage.

Then you add:

$(".prodbg").click(function(){
$("link").attr("href", "prodbg.css");
return false;
});

$(".homebg").click(function(){
$("link").attr("href", "homebg.css");
return false;
});

so when you click on the .prodbg class, which was just a link to the “product page” (basically this was just a learning experience to never have to reload a page,however without preloading the images it doesn’t work quite like that) it will change the css of the “linked” src to the new css, which is just a background image change. the .homebg does the same.