Skip to content

Commit

Permalink
fix #61 — Cannot read property offsetWidth of null when the selector …
Browse files Browse the repository at this point in the history
…doesnt exist (check earlier)
  • Loading branch information
pawelgrzybek committed Sep 18, 2017
1 parent 87b6411 commit 7e09002
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Loading

3 comments on commit 7e09002

@speciale
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Czesc !
Sorry to bother you but I have a problem that I'm unable to fix or even understand. Short version: when I use Siema in a single page I made, works like a charm, but when I try to use it in another project I get an error:
TypeError: this.selector is null siema.js:1:1538

Any idea?

Thanks in advance

@pawelgrzybek
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Siema :)

Check for selector earlier, and then instantiate Siema when it exists. Everything will work like a charm then. Example:

const mySiemaSelector = document.querySelector('.my-super-slider');

if (mySiemaSelector) {
  new Siema({
    selector: mySiemaSelector
  })
}

Have a great :-)

@speciale
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dziękuję bardzo! Works great now. Must say that I had a flexbox implementation that Siema did not love much. It wasn't the selector problem only

Please sign in to comment.