Skip to content

Commit

Permalink
Fix show tab feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
mookman288 committed Oct 18, 2015
1 parent 23c655e commit c661c7e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ <h4>Tabs</h4>
condimentum libero justo sed sem.
</p>
</div>
<p>Want to show a tab on page load? <a href="?showTab=tab-4">Click Here</a>.</p>
<p>Want to show a tab on page load? <a href="?tab=tab-4">Click Here</a>.</p>
</div>
<div id="footer">
<small>Copyright &copy; 2014 PxO Ink. Most Rights Reserved.</small>
Expand Down
2 changes: 1 addition & 1 deletion js/framework.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions src/js/80_ice.framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@ ice.tabs = (function($) {
var $this = $(this);
var hrefs = '';

//Confirm showtab exists.
$_GET.showTab = (typeof $_GET.showTab !== 'undefined') ? $_GET.showTab : false;
//Confirm tab exists.
$_GET.tab = (typeof $_GET.tab !== 'undefined') ? $_GET.tab : false;

//If there is no show tab.
if (!$_GET.showTab) {
if (!$_GET.tab) {
//Set the active class.
$this.find('a').eq(0).addClass('active');
}
Expand All @@ -384,7 +384,7 @@ ice.tabs = (function($) {
$that.attr('data-no-scroll', true);

//If there is a show tab, and this element matches.
if ($_GET.showTab && ('#' + $_GET.showTab) == $(this).attr('href')) {
if ($_GET.tab && ('#' + $_GET.tab) == $(this).attr('href')) {
//Activate.
$that.addClass('active');
}
Expand All @@ -403,15 +403,15 @@ ice.tabs = (function($) {
hrefs = hrefs.replace(/,+$/,'');

//If there is no show tab.
if (!$_GET.showTab) {
if (!$_GET.tab) {
//Hide all elements.
$(hrefs).not($this.find('a:first').addClass('active').attr('href')).hide();
} else {
//Scroll down.
$('#' + $_GET.showTab).ScrollTo();
//Scroll to the element.
jQuery('body, html').animate({scrollTop: $('#' + $_GET.tab).offset().top}, 400);

//Hide all but this element.
$(hrefs).not('#' + $_GET.showTab).hide();
$(hrefs).not('#' + $_GET.tab).hide();
}
});
})(jQuery);
16 changes: 8 additions & 8 deletions src/js/hint/80_ice.framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,11 @@ ice.tabs = (function($) {
var $this = $(this);
var hrefs = '';

//Confirm showtab exists.
$_GET.showTab = (typeof $_GET.showTab !== 'undefined') ? $_GET.showTab : false;
//Confirm tab exists.
$_GET.tab = (typeof $_GET.tab !== 'undefined') ? $_GET.tab : false;

//If there is no show tab.
if (!$_GET.showTab) {
if (!$_GET.tab) {
//Set the active class.
$this.find('a').eq(0).addClass('active');
}
Expand All @@ -384,7 +384,7 @@ ice.tabs = (function($) {
$that.attr('data-no-scroll', true);

//If there is a show tab, and this element matches.
if ($_GET.showTab && ('#' + $_GET.showTab) == $(this).attr('href')) {
if ($_GET.tab && ('#' + $_GET.tab) == $(this).attr('href')) {
//Activate.
$that.addClass('active');
}
Expand All @@ -403,15 +403,15 @@ ice.tabs = (function($) {
hrefs = hrefs.replace(/,+$/,'');

//If there is no show tab.
if (!$_GET.showTab) {
if (!$_GET.tab) {
//Hide all elements.
$(hrefs).not($this.find('a:first').addClass('active').attr('href')).hide();
} else {
//Scroll down.
$('#' + $_GET.showTab).ScrollTo();
//Scroll to the element.
jQuery('body, html').animate({scrollTop: $('#' + $_GET.tab).offset().top}, 400);

//Hide all but this element.
$(hrefs).not('#' + $_GET.showTab).hide();
$(hrefs).not('#' + $_GET.tab).hide();
}
});
})(jQuery);

0 comments on commit c661c7e

Please sign in to comment.