The script is supposed to change the element ID's by +1 on screen heights > 600px. It doesn't change them at all. But if I substract from them it works great. I tried ++, +1 and parseInt nothing seems to work. The first script below is what I need to work. The second script works using -1 instead of +1 but that't not what I need. Thanks.
<script>
var scrhtid = $(window).height();
var scrwtid = $(window).width();
if (scrhtid > 600) {
for (var i = 1; i < 30; i++) {
var scrollid = i;
var newscrollid = scrollid + 1;
$("#" + scrollid).attr("id",newscrollid);
}
}
</script>
Below works but need above to work
<script>
var scrhtid = $(window).height();
var scrwtid = $(window).width();
if (scrhtid > 600) {
for (var i = 1; i < 30; i++) {
var scrollid = i;
var newscrollid = scrollid - 1;
$("#" + scrollid).attr("id",newscrollid);
}
}
</script>
Aucun commentaire:
Enregistrer un commentaire