Guest User

Untitled

a guest
Dec 15th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. function setWidth() {
  2. var finalWidth = 0;
  3. var $collectionEl = $('.el');
  4. $collectionEl.each(function (indx, elem) {
  5. var elWidth = $(elem).width();
  6. if (elWidth > finalWidth) {
  7. finalWidth = elWidth;
  8. }
  9. });
  10. $collectionEl.css('min-width', finalWidth);
  11. }
  12.  
  13. $(document).ready(function () {
  14. setWidth();
  15. });
  16.  
  17. var resizeTimer;
  18. $(window).resize(function () {
  19. clearTimeout(resizeTimer);
  20. resizeTimer = setTimeout(function() {
  21. setWidth();
  22. }, 250);
  23. });
Add Comment
Please, Sign In to add comment