Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jun 16, 2017
1 parent 6d7bdfa commit e16bbc4
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/webparts/tabs/TabsWebPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Main components
float: left;
list-style-type: none;
}
.cd-tabs-navigation a {
.cd-tabs-navigation span {
position: relative;
display: block;
height: 60px;
Expand All @@ -170,17 +170,19 @@ Main components
color: #c3c2b9;
padding-top: 34px;
text-decoration: none;
cursor: pointer;
}
.no-touch .cd-tabs-navigation a:hover {
.no-touch .cd-tabs-navigation span:hover {
color: #29324e;
background-color: rgba(233, 230, 202, 0.3);
}
.cd-tabs-navigation a.selected {
.cd-tabs-navigation span.selected {
background-color: #ffffff !important;
box-shadow: inset 0 2px 0 ${this.properties.selectedColor};
color: #29324e;
cursor: auto;
}
.cd-tabs-navigation a::before {
.cd-tabs-navigation span::before {
/* icons */
position: absolute;
top: 12px;
Expand All @@ -198,15 +200,15 @@ Main components
width: 80px;
float: left;
}
.cd-tabs-navigation a {
.cd-tabs-navigation span {
height: 80px;
width: 80px;
padding-top: 46px;
}
.cd-tabs-navigation a.selected {
.cd-tabs-navigation span.selected {
box-shadow: inset 2px 0 0 ${this.properties.selectedColor};
}
.cd-tabs-navigation a::before {
.cd-tabs-navigation span::before {
top: 22px;
}
}
Expand All @@ -217,7 +219,7 @@ Main components
background-color: ${this.properties.disableColor};
box-shadow: inset 0 -2px 3px rgba(203, 196, 130, 0.06);
}
.cd-tabs-navigation a {
.cd-tabs-navigation span {
height: 60px;
line-height: 60px;
width: auto;
Expand All @@ -226,10 +228,10 @@ Main components
font-size: 0.875rem;
padding: 0 2.8em 0 4em;
}
.cd-tabs-navigation a.selected {
.cd-tabs-navigation span.selected {
box-shadow: inset 0 2px 0 ${this.properties.selectedColor};
}
.cd-tabs-navigation a::before {
.cd-tabs-navigation span::before {
top: 50%;
margin-top: -10px;
margin-left: 0;
Expand Down Expand Up @@ -298,7 +300,7 @@ Main components
html += '<div class="cd-tabs"><nav><ul class="cd-tabs-navigation">';

this.properties.tabs.map((tab: any, index: number) => {
html += '<li><a data-content="' + this.guid + index + '" class="' + (index == 0 ? "selected" : '') + '" href="#0">' + tab.Title + '</a></li>';
html += '<li><span data-content="' + this.guid + index + '" class="' + (index == 0 ? "selected" : '') + '">' + tab.Title + '</span></li>';
});

html += '</ul></nav><ul class="cd-tabs-content">';
Expand Down Expand Up @@ -364,22 +366,23 @@ Main components
tabContentWrapper = tab.children('ul.cd-tabs-content'),
tabNavigation = tab.find('nav');

tabItems.on('click', 'a', function(event){
tabItems.on('click', 'span', function(event){
event.preventDefault();
var selectedItem = $(this);
if( !selectedItem.hasClass('selected') ) {
var selectedTab = selectedItem.data('content'),
selectedContent = tabContentWrapper.find('li[data-content="'+selectedTab+'"]'),
slectedContentHeight = selectedContent.innerHeight();

tabItems.find('a.selected').removeClass('selected');
tabItems.find('span.selected').removeClass('selected');
selectedItem.addClass('selected');
selectedContent.addClass('selected').siblings('li').removeClass('selected');
//animate tabContentWrapper height when content changes
tabContentWrapper.animate({
'height': slectedContentHeight
}, 200);
}
return false;
});

//hide the .cd-tabs::after element when tabbed navigation has scrolled to the end (mobile version)
Expand Down

0 comments on commit e16bbc4

Please sign in to comment.