Menu with tabs that is responsive and changes based on tabs number
I have to create a menu with tabs; these tabs comes from an array of labels from the controller, so i can get the number of tabs actually available.
The selected tab must always contain the full label of the tab, and must be a little larger than the others; others tab can have just part of the label visible, filled with dots
(eg.: if i have 4 tabs called test1, test2, test3, test4, if the tabs are larger than the menu i will see:
test1
te...
te...
te...
with the test1 tab slightly larger than the others).
I actually tried with 3 different classes to be applied dynamically with ng-class (tabs are 1-5, 6-10, 11-15), and 3 classes for a selected tab, each of these with a min-width in percentage;
truncate is a class that makes all labels filled with "..." (
text-overflow: ellipsis
etc)selected: class applied for the selected tab that makes the tab white (instead of grey) and with a different label color.
index.html:
<div class="tab-header-container">
<div class="tab" ng-repeat="tab in tabs"
ng-class="
selected: tab.label==selectedTab.label,
'min-tabs': tabNum <=5,
'min-tabs-selected-tab': tabNum <=5 && tab.label==selectedTab.label,
'med-tabs': tabNum > 5 && tabNum <= 10,
'med-tabs-selected-tab': tabNum > 5 && tabNum <= 10 && tab.label==selectedTab.label,
'max-tabs': tabNum > 10,
'max-tabs-selected-tab': tabNum > 10 && tab.label==selectedTab.label
">
<div class="shadow-corrector truncate" ng-class="selected: tab.label==selectedTab.label" ng-click="onTabClick(tab)">
capitalize
</div>
</div>
</div>
index.css:
.min-tabs
min-width: 18%;
.min-tabs-selected-tab
min-width: 28%;
/* 6-10 tabs */
.med-tabs
min-width: 13%;
.med-tabs-selected-tab
min-width: 22%;
/* 11-15 tabs */
.max-tabs
min-width: 6%;
.max-tabs-selected-tab
min-width: 16%;
but what happens is that the title of the selected tab is not totally shown when selected.
This model should work with a maximum of 15 tabs which is actually the maximum possible number of tabs available.
What would happen is that tabs will fit the entire line - and must stay all in just one line; the selected tab slightly larger; the selected tab label must be always full shown; all tabs must fit the entire line regadless of how many they are.
I know that seems not difficult but i ran out of ideas. A help would be greatly appreciated.
html css angularjs
add a comment |
I have to create a menu with tabs; these tabs comes from an array of labels from the controller, so i can get the number of tabs actually available.
The selected tab must always contain the full label of the tab, and must be a little larger than the others; others tab can have just part of the label visible, filled with dots
(eg.: if i have 4 tabs called test1, test2, test3, test4, if the tabs are larger than the menu i will see:
test1
te...
te...
te...
with the test1 tab slightly larger than the others).
I actually tried with 3 different classes to be applied dynamically with ng-class (tabs are 1-5, 6-10, 11-15), and 3 classes for a selected tab, each of these with a min-width in percentage;
truncate is a class that makes all labels filled with "..." (
text-overflow: ellipsis
etc)selected: class applied for the selected tab that makes the tab white (instead of grey) and with a different label color.
index.html:
<div class="tab-header-container">
<div class="tab" ng-repeat="tab in tabs"
ng-class="
selected: tab.label==selectedTab.label,
'min-tabs': tabNum <=5,
'min-tabs-selected-tab': tabNum <=5 && tab.label==selectedTab.label,
'med-tabs': tabNum > 5 && tabNum <= 10,
'med-tabs-selected-tab': tabNum > 5 && tabNum <= 10 && tab.label==selectedTab.label,
'max-tabs': tabNum > 10,
'max-tabs-selected-tab': tabNum > 10 && tab.label==selectedTab.label
">
<div class="shadow-corrector truncate" ng-class="selected: tab.label==selectedTab.label" ng-click="onTabClick(tab)">
capitalize
</div>
</div>
</div>
index.css:
.min-tabs
min-width: 18%;
.min-tabs-selected-tab
min-width: 28%;
/* 6-10 tabs */
.med-tabs
min-width: 13%;
.med-tabs-selected-tab
min-width: 22%;
/* 11-15 tabs */
.max-tabs
min-width: 6%;
.max-tabs-selected-tab
min-width: 16%;
but what happens is that the title of the selected tab is not totally shown when selected.
This model should work with a maximum of 15 tabs which is actually the maximum possible number of tabs available.
What would happen is that tabs will fit the entire line - and must stay all in just one line; the selected tab slightly larger; the selected tab label must be always full shown; all tabs must fit the entire line regadless of how many they are.
I know that seems not difficult but i ran out of ideas. A help would be greatly appreciated.
html css angularjs
add a comment |
I have to create a menu with tabs; these tabs comes from an array of labels from the controller, so i can get the number of tabs actually available.
The selected tab must always contain the full label of the tab, and must be a little larger than the others; others tab can have just part of the label visible, filled with dots
(eg.: if i have 4 tabs called test1, test2, test3, test4, if the tabs are larger than the menu i will see:
test1
te...
te...
te...
with the test1 tab slightly larger than the others).
I actually tried with 3 different classes to be applied dynamically with ng-class (tabs are 1-5, 6-10, 11-15), and 3 classes for a selected tab, each of these with a min-width in percentage;
truncate is a class that makes all labels filled with "..." (
text-overflow: ellipsis
etc)selected: class applied for the selected tab that makes the tab white (instead of grey) and with a different label color.
index.html:
<div class="tab-header-container">
<div class="tab" ng-repeat="tab in tabs"
ng-class="
selected: tab.label==selectedTab.label,
'min-tabs': tabNum <=5,
'min-tabs-selected-tab': tabNum <=5 && tab.label==selectedTab.label,
'med-tabs': tabNum > 5 && tabNum <= 10,
'med-tabs-selected-tab': tabNum > 5 && tabNum <= 10 && tab.label==selectedTab.label,
'max-tabs': tabNum > 10,
'max-tabs-selected-tab': tabNum > 10 && tab.label==selectedTab.label
">
<div class="shadow-corrector truncate" ng-class="selected: tab.label==selectedTab.label" ng-click="onTabClick(tab)">
capitalize
</div>
</div>
</div>
index.css:
.min-tabs
min-width: 18%;
.min-tabs-selected-tab
min-width: 28%;
/* 6-10 tabs */
.med-tabs
min-width: 13%;
.med-tabs-selected-tab
min-width: 22%;
/* 11-15 tabs */
.max-tabs
min-width: 6%;
.max-tabs-selected-tab
min-width: 16%;
but what happens is that the title of the selected tab is not totally shown when selected.
This model should work with a maximum of 15 tabs which is actually the maximum possible number of tabs available.
What would happen is that tabs will fit the entire line - and must stay all in just one line; the selected tab slightly larger; the selected tab label must be always full shown; all tabs must fit the entire line regadless of how many they are.
I know that seems not difficult but i ran out of ideas. A help would be greatly appreciated.
html css angularjs
I have to create a menu with tabs; these tabs comes from an array of labels from the controller, so i can get the number of tabs actually available.
The selected tab must always contain the full label of the tab, and must be a little larger than the others; others tab can have just part of the label visible, filled with dots
(eg.: if i have 4 tabs called test1, test2, test3, test4, if the tabs are larger than the menu i will see:
test1
te...
te...
te...
with the test1 tab slightly larger than the others).
I actually tried with 3 different classes to be applied dynamically with ng-class (tabs are 1-5, 6-10, 11-15), and 3 classes for a selected tab, each of these with a min-width in percentage;
truncate is a class that makes all labels filled with "..." (
text-overflow: ellipsis
etc)selected: class applied for the selected tab that makes the tab white (instead of grey) and with a different label color.
index.html:
<div class="tab-header-container">
<div class="tab" ng-repeat="tab in tabs"
ng-class="
selected: tab.label==selectedTab.label,
'min-tabs': tabNum <=5,
'min-tabs-selected-tab': tabNum <=5 && tab.label==selectedTab.label,
'med-tabs': tabNum > 5 && tabNum <= 10,
'med-tabs-selected-tab': tabNum > 5 && tabNum <= 10 && tab.label==selectedTab.label,
'max-tabs': tabNum > 10,
'max-tabs-selected-tab': tabNum > 10 && tab.label==selectedTab.label
">
<div class="shadow-corrector truncate" ng-class="selected: tab.label==selectedTab.label" ng-click="onTabClick(tab)">
capitalize
</div>
</div>
</div>
index.css:
.min-tabs
min-width: 18%;
.min-tabs-selected-tab
min-width: 28%;
/* 6-10 tabs */
.med-tabs
min-width: 13%;
.med-tabs-selected-tab
min-width: 22%;
/* 11-15 tabs */
.max-tabs
min-width: 6%;
.max-tabs-selected-tab
min-width: 16%;
but what happens is that the title of the selected tab is not totally shown when selected.
This model should work with a maximum of 15 tabs which is actually the maximum possible number of tabs available.
What would happen is that tabs will fit the entire line - and must stay all in just one line; the selected tab slightly larger; the selected tab label must be always full shown; all tabs must fit the entire line regadless of how many they are.
I know that seems not difficult but i ran out of ideas. A help would be greatly appreciated.
html css angularjs
html css angularjs
edited Nov 12 at 17:09
wanttobeprofessional
91131223
91131223
asked Nov 12 at 11:48
Diego
168217
168217
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261528%2fmenu-with-tabs-that-is-responsive-and-changes-based-on-tabs-number%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53261528%2fmenu-with-tabs-that-is-responsive-and-changes-based-on-tabs-number%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown