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

Posted on 2014-08-11
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:kasondeneddy
    LVL 70

    Expert Comment

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

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

    Author Comment

    Visit, 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

    jQuery(function() {
    if((window.location.pathname=="/"||window.location.pathname=="") &&""){ = "none";

    Open in new window

    Made some edits

    Author Closing Comment

    This worked perfectly, thanks so much, also learnt a thing or two!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Suggested Solutions

    I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
    In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now