The UI component of the AiteStory project.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
640 B

  1. /*
  2. Makes
  3. */
  4. document.addEventListener("DOMContentLoaded", function(event) {
  5. var img = document.getElementById('main-background');
  6. if(isLoaded(img)) {
  7. var width = img.clientWidth;
  8. var height = img.clientHeight;
  9. if(width > (height * 1.50)) {
  10. img.className += ' landscape';
  11. }
  12. } else {
  13. img.onload = function () {
  14. var width = img.clientWidth;
  15. var height = img.clientHeight;
  16. if(width > (height * 1.50)) {
  17. img.className += ' landscape';
  18. }
  19. }
  20. }
  21. });
  22. function isLoaded(img) {
  23. return img.complete && typeof(img.naturalHeight) !== 'undefined' && img.naturalHeight !== 0;
  24. }