- var data = {categories: [{ link: "#cat1", name: "Категория1", },{ link: "#cat2", name: "Категория2", },{ link: "#cat3", name: "Категория3", },{ link: "#cat4", name: "Категория4", },{ link: "#cat5", name: "Категория5", },{ link: "#cat6", name: "Категория6", },{ link: "#cat7", name: "Категория7", },{ link: "#cat8", name: "Категория8", },{ link: "#cat9", name: "Категория9" }]};
- var categories;
- while (data.categories.length > 0)
- categories = data.categories.splice(0,4);
ul
each category in categories
li: a(href=category.link)= category.name
p
| Lorem ipsum dolor sit amet,
a(href="#") putent admodum
| assentior ei his, esse porro fabulas his id. Duo enim agam graeco eu, eu vide aliquam eum. Mei ea essent everti expetenda. Civibus deseruisse
b referrentur
| eu mei, quem feugiat efficiendi vis an.
br
| Ad mea cetero impedit persecuti. Dicam ridens vis ad, eam reque vitae vulputate cu. Veniam consetetur no nec, debitis dissentias theophrastus id vis. Ad vim everti copiosae. Ut exerci repudiandae qui.
mixin main-menu-submenu(data)
ul.main-menu-submenu&attributes(attributes)
each item in data
li.main-menu-submenu__item
a(href="#{item.url}")= item.title
mixin main-menu(data)
nav.main-menu.js-link-sroll&attributes(attributes)
ul
each item in data
- var itemClasses = ['main-menu__item']
//- Доп класс для пунктов с подменю
if (item.submenu !== false)
- itemClasses.push(itemClasses[0] + '_dropdown')
li(class=itemClasses)
a(href="#{item.url}").main-menu__link= item.title
if (item.submenu !== false)
.main-menu__submenu
+main-menu-submenu(item.submenu)
{
"menu": [
{
"title": "Level 1 title 1",
"url": "#url1",
"submenu": [
{
"title": "Submenu item 1",
"url": "url2"
},
{
"title": "Submenu item 2",
"url": "url3"
}
]
},
{
"title": "Level 1 title 2",
"url": "#url4",
"submenu": false
}
]
}
{
"title": "Title text",
"items": [
{
"title": "Item 1"
},
{
"title": "Item 2",
"sublevel": true,
"items": [
{
"title": "Item 2.1"
},
{
"title": "Item 2.2"
},
{
"title": "Item 2.2",
"sublevel": true,
"items": [
{
"title": "Item 2.2.1",
"sublevel": true,
"items": [
{
"title": "Item 2.2.2.1"
},
{
"title": "Item 2.2.2.2"
},
{
"title": "Item 2.2.2.3"
}
]
},
{
"title": "Item 2.2.2"
},
{
"title": "Item 2.2.3"
}
]
}
]
},
{
"title": "Item 3"
}
]
}
mixin list(data)
ul
each item in data.items
li= item.title
if item.sublevel
+list(item)