Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var menuMore = function() {
- var menu = $('.catalog-category__list'),
- menuWidth = menu.width(),
- menuItems = $('li', menu),
- itemsWidth = 0,
- moreBlock = $('.catalog-category__list-more'),
- moreBlockWidth = moreBlock.outerWidth(true),
- checkWidth = menuWidth - moreBlockWidth,
- moreList = $('.catalog-category-more__list'),
- breackpoint = 1680;
- moreBlock.hide();
- menuItems.each(function() {
- var $this = $(this);
- menu.append($this);
- if (windowWidth <= breackpoint) {
- moreBlock.hide();
- return;
- }
- if ($this.hasClass('catalog-category__list-more')) return;
- itemsWidth += $this.outerWidth(true);
- if (itemsWidth < checkWidth) {
- menu.append($this);
- } else {
- moreList.append($this);
- moreBlock.show();
- }
- });
- }
Add Comment
Please, Sign In to add comment