Forums

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

Home Forums CSS jQuery background-image change on hover

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23329
    andrewsquidge
    Participant

    Hi guys,

    I hope one of you jQuery genius’ can help me out on this. I’m trying to replicate the BBC style news items on their homepage. When you hover over a story title the accompanying image changes on the left hand side. I’ve created a test page using jQuery to run a function on hover that changes the background image of a div class.

    This is the link: http://nawp.org.uk/bbctest.html

    It works when there is only one function and one command but as soon as you insert a second (or third) it won’t do anything! Ideally I’d like to tidy this up a bit by passing a variable to the function which defines the URL of the image but I wanted to get it working first!!

    This is the code for a single function and command (this one works):

    Code:

    The page that is not working is the page above (http://nawp.org.uk/bbctest.html).

    Any help would be very much appreciated.

    Thanks in advance.
    Andrew

    #50190
    andrewsquidge
    Participant

    I seem to have solved this using the mouseover attribute rather than hover. Are there any drawbacks to this approach?

    Cheers

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.