• Hi – I want to place some background images behind my navigation links using JQuery. I have spent hours Googling the most promising solution which do not work in the context of WordPress:

    applied to my own situation I come up with:

    $('ul li :eq(0)').css('background',  'url(../images/home_icon.gif)');
     $('ul li :eq(1)').css('background',  'url(../images/flower.gif)');

    Can anyone please suggests the correct syntax to get an image behind a ul li a ?

    Many Many Thanks – I’m pulling my hair out.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try replacing all “$” characters with “jQuery”. jQuery and Prototype both use the dollar sign, and thus have a conflict.

    I haven’t checked your code though.

    Thread Starter vincej1

    (@vincej1)

    Thanks – I gave that a go but it had no effect.

    I am almost 100% certain that the issue lies with url piece of the code, for as a control I have in fact also tried:

    $('ul li :eq(0)').css('background', 'green');
     $('ul li :eq(1)').css('background', 'red');

    This works perfectly.

    any ideas are really welcome – I am defeated !

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to Use JQuery CSS "background" with an image ?’ is closed to new replies.