Skip to content

Commit

Permalink
fixed an issue that cause when there is no hash on saTabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz committed Mar 1, 2018
1 parent cb44ffc commit 4364dc9
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions scrollimate.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,25 @@ var scrollimate = (function( window, $ ){
}
else{
location = String(document.location);
location = location = location.split("#")[1]; // wtf is this ...
location = location = location.split("#")[1]; // if the location is not passed as master input, we use the has instead!
}

if (location === undefined || location === 'all' ){
$("[data-tabscroll]:first-of-type").show();
$("[data-tabscroll]:first-of-type").addClass('activeTab');
// check if location resolves to a tab and sets the exists variable to true
var $allTabs = $("[data-tabscroll]");
var exists = false;
for(i=0; i < $allTabs.length; i++){
var curtab = $($allTabs[i]).attr('data-tabscroll');
console.log( curtab );
if( curtab === location ){
exists = true;
}
}

if (location === undefined || location === 'all' || exists === false){
var $firstTab = $("[data-tabscroll]:first-of-type");
$firstTab.show();
$firstTab.addClass('activeTab');
window.location.hash = $firstTab.attr('data-tabscroll');
}
else{
$("[data-tabscroll]").hide().removeClass('activeTab');
Expand Down Expand Up @@ -695,9 +708,4 @@ var scrollimate = (function( window, $ ){
nonIDTabs: nonIDTabs,
enableMobile: enableMobile,
};
})(window, jQuery);





})(window, jQuery);

0 comments on commit 4364dc9

Please sign in to comment.