Last active
January 26, 2018 19:12
-
-
Save AlexKardone/186b5861765954aab50891f2095173c0 to your computer and use it in GitHub Desktop.
Подгонка ширины блока под ширину окна
This file contains hidden or 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
function widthDetect() { | |
$('.class-name').css('width', $(window).width()); | |
}; | |
$(window).resize(function() { | |
widthDetect(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Если нужно, чтобы при изменении размера окна ширина блока подгонялась под новый размер, используем эту функцию.
Также можно вызывать ее сразу, без события.