Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Need help with writing a simple script to disable the display of background image on website

Posted on 2014-08-11
Medium Priority
Last Modified: 2014-08-11
Need help writing simple jquery or php script to detect if I am on the homepage, and notthe background image on the homepage.
Question by:Kasonde Neddy
  • 2
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40253583
Please post your script to this point.

Or by "help" do you actually mean "write the thing for me"?

Author Comment

by:Kasonde Neddy
ID: 40253600
Visit www.bookworldzambia.com, and check code behind, I have the background image injected into page inline styling through wordpress.  But need a script that will hide the background image from home page.  An if statement, that would check if I am on the homepage, if so, hide background image.  Clear?  Thanks for the quick response.  Been away from coding for a while
LVL 58

Accepted Solution

Gary earned 2000 total points
ID: 40253819
jQuery(function() {
if((window.location.pathname=="/"||window.location.pathname=="") && window.location.search==""){
  document.body.style.backgroundImage = "none";

Open in new window

Made some edits

Author Closing Comment

by:Kasonde Neddy
ID: 40254334
This worked perfectly, thanks so much, also learnt a thing or two!

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
While Plesk offers many potential benefits to website administrators, including compatibility with Windows Server and other leading technologies, the company has also been working to differentiate it from other control panels for content managementā€¦
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like theā€¦
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question