Created
May 20, 2015 00:46
-
-
Save CodyKochmann/5692fd98f4a6b87a8a96 to your computer and use it in GitHub Desktop.
sets horizontal or vertical view rules of a dom element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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