Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:56:48+00:00 2026-06-04T14:56:48+00:00

I’m a bit stuck right now, I basically have my header element in the

  • 0

I’m a bit stuck right now, I basically have my header element in the DOM and I have a background image hard coded in the CSS for the index page.

What I was looking to do was for this image to change on different pages. I thought this was going to be a pretty simple thing to do.

$('header').css("background-image","url(assets/img/consulting.png)")

I realise there is no event trigger, but I was under the impression that I wouldn’t need to actually do that.

Also my CSS file and file for the page I’m adding the jQuery to are in different folders as is the img folder… I’m unsure where how I should be calling the url in the jQuery code. Should it be as though navigating from the CSS file or the HTML file?

Thanks guys, sorry if I missed something really obvious here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:56:49+00:00Added an answer on June 4, 2026 at 2:56 pm

    This is the approach I would take, simply to remove the majority of the css from jQuery although you may simple want a click event.

    I would do this for each page.

    <body class="home">
    <body class="about">
    <body class="contact">
    

    Then in your CSS do

    .home header { background-image: url(../assets/img/consulting.png"; }
    .about header { background-image: url(../assets/img/consulting2.png"; }
    .contact header { background-image: url(../assets/img/consulting3.png"; }
    

    If your site is a single index that loads content of the other pages without refreshing them you can do.

    $(function(){
        $('#aboutlink').click(function(e){
            $('body').removeClass().addClass('about');
    
            //your other snippets here
    
            e.preventDefault();
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.