0

Hello!

I have some i like this:
<i class="pcon" style="background-image: url(./styles/SkyBoot/imageset/topic_unread.gif); background-repeat: no-repeat;">

I want to change only this:
styles/SkyBoot/imageset
to this:
styles/SkyBoot/imageset/black

Because i have cookies and i want to create second template. I want this to change images for my black template (second theme)

I try with:
jQuery('.pcon').each(function(e) {return e.css.replace('styles/SkyBoot/imageset/', 'styles/SkyBoot/imageset/black');});

but without success.
I need for each element, because i have more than one. Thanks for any help!

Edited by grakovski

2
Contributors
4
Replies
21
Views
2 Years
Discussion Span
Last Post by grakovski
0
// short version
$('.pcon').each(function(){
         $(this).css('background-image',$(this).css('background-image').replace('/styles/SkyBoot/imageset/','/styles/SkyBoot/imageset/black/'));
    }
);

// long version for clarity
$('.pcon').each(function(){
        var el = $(this);
        var oldBackground = el.css('background-image');
        var newBackground = oldBackground.replace('/styles/SkyBoot/imageset/','/styles/SkyBoot/imageset/black/');
        el.css('background-image',newBackground);
    }
);

However, find/replace is not the best way to deal with alternating themes. You could save a lot of hassle like this even by using a different stylesheet for each theme.

0

Thanks and I know but its phpbb theme and its hard to work with 2 stylesheets.

However, your two versions not working for me.

Edited by grakovski

0

No i running it before :)
I added ( document ).ready(function() { and it works! Thank you!

Edited by grakovski

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.