Reputation: 14833
i really need some help with this:
i have a div container #green (green border) with a bg image. the div is on 100% width and the bg image with css3's -cover-. In this div is another div #red which has a position absolute and right value. i want force the #red div to have always the same distance between a motive of the bg image. means if im scaling the browser window the gap should always be the same.
my try was to divide the #red { right: 25px }
css by $(window).width()
and use this factor for
var factor = 0,253;
var width = $(window).width()*factor;
('#red').css('right', width);
but it does not work. hope you get my point, and every help would be much appreciated :)
Upvotes: 0
Views: 300
Reputation: 171700
var factor = 0,253
is invalid syntax
SHould be
var factor = 0.253;
Use a browser console to check errors, this would pop right out
Upvotes: 0