Skip to content

Commit

Permalink
feat: Add onResize option to run after frame rebuild (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
DenverCoder1 authored Sep 4, 2022
1 parent 109626d commit 3e8f9c8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 593 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ new Siema({
rtl: false,
onInit: () => {},
onChange: () => {},
onResize: () => {},
});
```

Expand Down Expand Up @@ -96,6 +97,9 @@ Runs immediately after initialization [(example)](http://codepen.io/pawelgrzybek
**`onChange`** (function)
Runs after slide change [(example)](http://codepen.io/pawelgrzybek/pen/RVbrVe).

**`onResize`** (function)
Runs on window resize after the frame is rebuilt [(example)](https://codepen.io/eyl327/pen/OJZPVRy).

## API

As mentioned above, Siema doesn't come with many options - just a few useful methods. Combine it with some very basic JavaScript and voila!
Expand Down
2 changes: 1 addition & 1 deletion dist/siema.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/siema.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ new Siema({
rtl: false,
onInit: () => {},
onChange: () => {},
onResize: () => {},
});
```

Expand Down Expand Up @@ -112,6 +113,9 @@ Runs immediately after initialization [(example)](http://codepen.io/pawelgrzybek
**`onChange`** (function)
Runs after slide change [(example)](http://codepen.io/pawelgrzybek/pen/RVbrVe).

**`onResize`** (function)
Runs on window resize after the frame is rebuilt [(example)](https://codepen.io/eyl327/pen/OJZPVRy).

## API

As mentioned above, Siemano doesn't come with many options - just a few useful methods. Combine it with some very basic JavaScript and voila!
Expand Down
3 changes: 3 additions & 0 deletions src/siema.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default class Siema {
rtl: false,
onInit: () => {},
onChange: () => {},
onResize: () => {},
};

const userSttings = options;
Expand Down Expand Up @@ -434,6 +435,8 @@ export default class Siema {
this.selectorWidth = this.selector.offsetWidth;

this.buildSliderFrame();

this.config.onResize.call(this);
}


Expand Down
Loading

0 comments on commit 3e8f9c8

Please sign in to comment.