WordPress – change background with jquery in an article


For my support-article i wanted to change the background of my wordpress but only for this special article. So i had a closer look for jquery. The following example showed what i made to change the background:

<script src="http://www.web-dreamer.de/blog/jquery.js" type="text/javascript"></script><script type="text/javascript">$(document).ready(function() {$("body").css("background", "none");
$("body").css("background-image", "url(http://www.web-dreamer.de/header/header.image.php)");
 });</script>

I just embedded this snippet in my article in html-mode and saved. I don’t know if this works also for other wordpress installations, but it worked well for mine.
So if you don’t want to change it in the main-page you may want to add some empty lines otherwise this script will also be used on the main page and that’s maybe not what you want.

Hinterlasse eine Antwort