I want to move a DOM Object inside another in specific screen sizes. I was inspired by this answer but i work with a layout thats changable with LESS so even it i use fixed widths on the objects i don't want to use with as a trigger. I like it because its lightweight and it dot requires something like equire.js or modernizr to emulate media queries and it works well for my purpose.
I right now use a bottom margin of 1px but i am not satisfied with this so i am looking for the most useless and meaning less css i can find to use it as a trigger. I heared about the "move-to" of css3 but seems its still a incomplete draft and not implemented in any browser. And if i am right browsers not even read it. At least its not showing up in firebug.
This is what i do:
css
@media screen and (min-width: 768px) {
.sidebar-secondary {
margin-bottom: 1px;
}
}
@media screen and (min-width: 992px) {
.sidebar-secondary {
margin-bottom: 0;
}
}
js
var sidebar_move = function(){
if ( $(".sidebar-secondary").css("margin-bottom") === "1px") {
$(".sidebar-secondary").appendTo(".sidebar-primary");
}
}
window.setInterval(sidebar_move, 1000);
any idea if a "useless" css value i can use. some thing nobody uses. I like it to me as conflictless as possibe and changing css from other persons should not get interfere with this, so margin is a very bad solution for this.
and since almost everybody seems to have the opinion i should bloat my code up with java-script i like to know reasons for this.
and btw i think this is more reliable then pulling window width with javascript if i understand this right this is why complicated scripts like eqire.js exist or am i wrong?
Whats so bad with having js depend on css? i want to use it for this specific thing and nothing else.
min-width: 1px;