Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript appending stylesheet on window resize Reply To: appending stylesheet on window resize

#176268
noahgelman
Participant

Well… if you really CAN’T use media queries, then I wouldn’t go the route you’re trying to go.

The biggest problem after attaching a styling sheet, is removing it when sized back up.

What I would do instead which is much easier is on window resize change a class on the html or body tag. For example: sm, med, lrg, xl.

That way, you can have ALL your css on the same style sheet and target different sizes

div {
background:blue;
}

html.sm div {
background:red;
}