Skip to content

Instantly share code, notes, and snippets.

@CodyKochmann
Created May 20, 2015 00:46
Show Gist options
  • Save CodyKochmann/5692fd98f4a6b87a8a96 to your computer and use it in GitHub Desktop.
Save CodyKochmann/5692fd98f4a6b87a8a96 to your computer and use it in GitHub Desktop.
sets horizontal or vertical view rules of a dom element
var set_view = function(dom_e){
// sets horizontal or vertical view rules of a dom element
// by: Cody Kochmann
var width = $(window).width();
var height = $(window).height();
var horizontal=width>height;
var vertical=!horizontal;
if (horizontal){
if(dom_e.hasClass('horizontal')==false){
dom_e.addClass('horizontal');
}
if(dom_e.hasClass('vertical')==true){
dom_e.addClass('vertical');
}
}
if (vertical){
if(dom_e.hasClass('vertical')==false){
dom_e.addClass('vertical');
}
if(dom_e.hasClass('horizontal')==true){
dom_e.addClass('horizontal');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment