Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Redimensiona a imagem de acordo com o tamanho da janela
- * @param {jQueryObject} image
- * @param {Integer} imgWidth
- * @param {Integer} imgHeight
- */
- function resizeBackground(image, imgWidth, imgHeight){
- var win = $(window),
- winWidth = win.width(),
- winHeight = win.height(),
- aspectRatio = winWidth/winHeight;
- imgAspectRatio = imgWidth/imgHeight;
- if ( aspectRatio < imgAspectRatio ) {
- image.removeClass('full-width').addClass('full-height');
- } else if ( aspectRatio > imgAspectRatio ) {
- image.removeClass('full-height').addClass('full-width');
- }
- }
Add Comment
Please, Sign In to add comment