Yasir
Yasir

Reputation: 3907

my jquery code not working IE6,IE7

code below working fine but not in IE6, IE7, below is the code is there any error please help

$(document).ready(function(){

    $(".backgroundElement").bind( "keyup change", function () {

        var color=$("#colorpickerField1").attr('value');
        var brnbackgroundurl=$("#brnbackgroundurl").attr('value');
        var scrollwithpage=$('#scrollwithpage').val();
        var bgposition=$('#bgposition').val();
        var bgrepeat=$('#bgrepeat').val();

        $("body").css({
           'background':'#'+color,
           'background':'url('+brnbackgroundurl+')'+bgrepeat+' '+ bgposition,
           'background-attachment':scrollwithpage
        });
    });

});

Upvotes: 0

Views: 537

Answers (2)

Ward Werbrouck
Ward Werbrouck

Reputation: 1462

'url('+brnbackgroundurl+')'+bgrepeat

I think the error is in this part, you are missing a space.

Like this:

'url('+brnbackgroundurl+') '+bgrepeat

And to avoid more problems, just use the correct attribute order. Example from w3schools:

background: #00ff00 url('smiley.gif') no-repeat fixed center;

Upvotes: 1

ThoKra
ThoKra

Reputation: 3029

You do set the background twice.. Try using background-image for the second parameter.

Upvotes: 0

Related Questions