Why you're forcing user to react on changing classes on body? What about, if these classes are already used by other solution or piece of code?
Wouldn't it be easier and more generic to change:
$(window).trigger('reorient');
to:
$(window).trigger('reorient', [orient]);
This way, if someone does want to have classes, he/she can set them to body manually. And if someone else want to know current orientation directly in event (for example to be used in some JS code), then he/she is also satisfied by this modification. While with your original code, second is not possible, without checking for body class changes in reorient event. Which -- as I said -- will eventually fall at all if some other piece of code is using the same classes or modifies body in some way.
Why you're forcing user to react on changing classes on
body? What about, if these classes are already used by other solution or piece of code?Wouldn't it be easier and more generic to change:
to:
This way, if someone does want to have classes, he/she can set them to body manually. And if someone else want to know current orientation directly in event (for example to be used in some JS code), then he/she is also satisfied by this modification. While with your original code, second is not possible, without checking for
bodyclass changes inreorientevent. Which -- as I said -- will eventually fall at all if some other piece of code is using the same classes or modifiesbodyin some way.