Reputation: 1255
I have a body element:
<body id="body" class="watermark">
Css class "watermark" is:
.watermark { background-image: url('/assets/images/watermark.png');
background-repeat: repeat;
background-position: -250px 850px; }
I need change background position under some circuumstances:
<script>
$( document ).ready(function() {
$("#body").css = ('backgroundPosition','-250px 50px');
});
</script>
But this doesn't work. I've tryed both backgroundPosition
and background-position
but body element is still keeping orginial background-position values defined in css. No error in console. What I'm doing wrong?
Upvotes: 2
Views: 699
Reputation: 82231
You need to use:
$('#body').css('background-position', '-250px 50px');
or
$('#body').css('backgroundPosition', '-250px 50px');
Upvotes: 2