diff options
author | postblue <postblue+git@postblue.info> | 2014-06-25 11:23:34 +0400 |
---|---|---|
committer | postblue <postblue+git@postblue.info> | 2014-06-25 11:23:34 +0400 |
commit | 1ae5a929864038b81d8ede3bf3acdc7686cd393d (patch) | |
tree | 4626539e43d323b1a431d71798a499e94e919f48 | |
parent | 76b7e172c1ed00557fabd06f7ada00275bc153c1 (diff) |
Update to FitVids.JS 1.1
-rw-r--r-- | assets/js/jquery.fitvids.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/assets/js/jquery.fitvids.js b/assets/js/jquery.fitvids.js index b9b8d5d..05e24cc 100644 --- a/assets/js/jquery.fitvids.js +++ b/assets/js/jquery.fitvids.js @@ -15,7 +15,8 @@ $.fn.fitVids = function( options ) { var settings = { - customSelector: null + customSelector: null, + ignore: null }; if(!document.getElementById('fit-vids-style')) { @@ -45,12 +46,27 @@ selectors.push(settings.customSelector); } + var ignoreList = '.fitvidsignore'; + + if(settings.ignore) { + ignoreList = ignoreList + ', ' + settings.ignore; + } + var $allVideos = $(this).find(selectors.join(',')); $allVideos = $allVideos.not("object object"); // SwfObj conflict patch + $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. $allVideos.each(function(){ var $this = $(this); + if($this.parents(ignoreList).length > 0) { + return; // Disable FitVids on this video. + } if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } + if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) + { + $this.attr('height', 9); + $this.attr('width', 16); + } var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), aspectRatio = height / width; |