Skip to content

Commit

Permalink
fix $active[0] undefined bug with tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
gantrim committed May 15, 2018
1 parent 9763462 commit cf8f4d3
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 7 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# ABOUT
Materialize CSS Packaged for meteor and using stylus. This packages allows you to use all variables available in the SCSS materialize package with the clean syntax of stylus.
# INSTALL
Please make sure to remove the base meteor materialize package. This package has everything you need.
```
$ meteor add stylus
$ meteor add gantrim:materialize-stylus
```

# STYLUS
After you have added this package, create a main .styl file and add the following
```
@import '{gantrim:materialize-stylus}/lib/styl/components/_mixins.import'
@import '{gantrim:materialize-stylus}/lib/styl/components/_color.import'
@import '{gantrim:materialize-stylus}/lib/styl/components/_variables.import'
// add your own variables/overrides here
@import '{gantrim:materialize-stylus}/lib/styl/materialize-components'
```

# CONTRIBUTING
Bug fixes and pull requests welcome. At the very least, if you notice an issue please open an issue on github.

# CREDIT/THANKS
[Materialize](https://github.com/Dogfalo/materialize)

[meteor-materialize-scss](https://github.com/poetic/meteor-materialize-scss)

[Sass2Stylus](https://github.com/mojotech/sass2stylus)
9 changes: 7 additions & 2 deletions lib/js/bin/materialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,9 @@ $(document).ready(function(){
$index = 0;
}

$content = $($active[0].hash);
if ($active[0] !== undefined) {
$content = $($active[0].hash);
}

// append indicator then set indicator width to tab width
$this.append('<div class="indicator"></div>');
Expand Down Expand Up @@ -1249,7 +1251,10 @@ $(document).ready(function(){

// Make the old tab inactive.
$active.removeClass('active');
$content.hide();

if ($content !== undefined) {
$content.hide();
}

// Update the variables with the new link and content
$active = $(this);
Expand Down
8 changes: 6 additions & 2 deletions lib/js/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
$index = 0;
}

$content = $($active[0].hash);
if ($active[0] !== undefined) {
$content = $($active[0].hash);
}

// append indicator then set indicator width to tab width
$this.append('<div class="indicator"></div>');
Expand Down Expand Up @@ -71,7 +73,9 @@

// Make the old tab inactive.
$active.removeClass('active');
$content.hide();
if ($content !== undefined) {
$content.hide();
}

// Update the variables with the new link and content
$active = $(this);
Expand Down
6 changes: 3 additions & 3 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
Package.describe({
name: 'gantrim:materialize-stylus', // http://atmospherejs.com/materialize/materialize
summary: 'Materialize (official): A modern responsive front-end framework based on Material Design',
version: '1.1.3',
version: '1.1.8',
git: 'https://github.com/gantrim/meteor-materialize-stylus'
});

Package.onUse(function (api) {
api.versionsFrom('METEOR@1.2.1');
api.versionsFrom('METEOR@1.6.0.1');

api.use('[email protected].14');
api.use('[email protected].13');
api.use('jquery', 'client');
api.imply('jquery', 'client');

Expand Down

0 comments on commit cf8f4d3

Please sign in to comment.