mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-24 00:23:50 +00:00
hop
This commit is contained in:
@@ -29,8 +29,11 @@ let countNewActive = function(links, link)
|
||||
/*
|
||||
* Set class active on both new elements: link and content
|
||||
*/
|
||||
let setNewActive = function(link, contents, rank)
|
||||
let setNewActive = function(links, contents, rank)
|
||||
{
|
||||
if (! links[rank-1]) { rank = 1; }
|
||||
link = links[rank-1];
|
||||
|
||||
link.classList.add('active');
|
||||
|
||||
count = 0;
|
||||
@@ -42,6 +45,19 @@ let setNewActive = function(link, contents, rank)
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Set height of content pane
|
||||
*/
|
||||
let setPaneHeight = function(contents)
|
||||
{
|
||||
contents.forEach(function(pane) {
|
||||
|
||||
// let computedStyle = getComputedStyle(pane);
|
||||
// console.log(computedStyle.height);
|
||||
// comment prendre la hauteur d'une div masquée avec display:none
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Main function
|
||||
*/
|
||||
@@ -61,15 +77,21 @@ window.addEventListener('load', function()
|
||||
tabPanel.classList.add('pills');
|
||||
}
|
||||
|
||||
if (! unit.startPanel) {
|
||||
unit.startPanel = 1;
|
||||
}
|
||||
|
||||
setPaneHeight(contents);
|
||||
|
||||
// initial position
|
||||
setNewActive(links[unit.startPanel-1], contents, unit.startPanel);
|
||||
setNewActive(links, contents, unit.startPanel);
|
||||
|
||||
// listen
|
||||
links.forEach(function(link) {
|
||||
link.addEventListener('click', function()
|
||||
{
|
||||
resetActive(links, contents);
|
||||
setNewActive(link, contents, countNewActive(links, link));
|
||||
setNewActive(links, contents, countNewActive(links, link));
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user