I m having slight troubles with my code. What I m trying to do is make these element s css property left update according to the difference of it s current left value, and the amount the page resizes. This way, when the page resizes and the background moves over, the elements will move too. Take a look at the code below and I ll describe the issue:
$(window).resize(function() {
var docWidth = $(window).width();
if (docWidth < 1000) {
var difference = 1000-docWidth;
$( #headNav a,#icons div ).each(function() {
var left = $(this).position().left;
var newLeft = left - difference;
$(this).css({ left : newLeft });
});
}
});
因此,“我得来”的问题是,这些要素被赋予了野生物种的剩余价值,而变数的新Left的价值是合理和理想的价值。 我认为,每一项职能都是收集这些价值的总和,并用于所发现的每个要素的x倍(如果有5个要素,我指的是) 我想的是,这部法律对每个要素都具有独特性,但只是一次,而不是每个要素10倍! (其中有多少要素在html)。
So my question is, how can this be achieved? I hope I explained myself well enough, this was tough to iterate. Any help is extremely appreciated. Thank you!