I have function, a part of it works non-correct.
What i need -
1) if window width < 768 (do smth) 2) if window width = 768 (do smth) 3) else (do smth)
There is a part of function
var windowWid = $(window).width();
if ($poselok.length > 0) {
if (windowWid === 768) {
var offset = 0.05;
}
if (windowWid < 768) {
var offset = 0 - $el_full.offset().left - el_margin_left;
} else {
var offset = 0 - $el_full.offset().left + $sideLeft + 15;
}
} else {
var offset = 0 - $el_full.offset().left - el_margin_left;
};
Without if (windowWid < 768) condition if (windowWid === 768) works, but with it - doesn't.
I tried if (windowWid < 767) and if (windowWid <= 767) to separate if but nothing.
I tried replace if, (windowWid === 768) works but if (windowWid < 768) works incorrect.
I think i have mistake in Execution order, but don't know how to fix it.
Help please!
Aucun commentaire:
Enregistrer un commentaire