rytm-webflow 2.1.4 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -297,11 +297,15 @@ RytmWebflow.aswap.init({
297
297
  }
298
298
  })
299
299
  ```
300
- Add data attributes to the cointainer element. Inside the container place elements that include the `webscroll` data attributes (initial, show, hide):
300
+ Add data attributes to the cointainer element. Inside the element grabbed by the selector place elements that include the `webscroll` data attributes (initial, show, hide):
301
301
  ```html
302
302
  <div id="stage">
303
303
  <ul data-as-view="list" data-as-id="uid" data-webset="selector:li,stagger:.1">
304
- <li data-webscroll-initial="o:0" data-webscroll-show="o:1,t:.5" data-webscroll-hide="o:0,t.4">...</li>
304
+ <li>
305
+ <div data-webscroll-initial="o:0" data-webscroll-show="o:1,t:.5" data-webscroll-hide="o:0,t.4">
306
+ ...
307
+ </div>
308
+ </li>
305
309
  </ul>
306
310
  </div>
307
311
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rytm-webflow",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "rytm webflow pack - ASwap, ShowUp",
5
5
  "main": "scripts/index.js",
6
6
  "scripts": {
@@ -22,6 +22,7 @@ class ASwap {
22
22
  oldschoolBrowserFallback: true, // IE11 or lower is not supported
23
23
  preloadOnHover: false, // preload links on hover
24
24
  refreshOnSameUrl: true, // refresh window if same URL is requested
25
+ refreshOnContentParseError: true, // refresh window if loaded request has special characters
25
26
  routes: {},
26
27
  swapSelector: '#stage', // swap wrapper selector
27
28
  defaultDocumentScrollBehavior: 'smooth',
@@ -70,7 +70,7 @@ class ASwapDispatcher extends EventDispatcher {
70
70
  if (body && body[index]) {
71
71
  return body[index];
72
72
  } else {
73
- this.warning("AS problem - " + tag + " could not be extracted, index:", idnex);
73
+ this.warning("AS problem - " + tag + " could not be extracted, index:", index);
74
74
  return false;
75
75
  }
76
76
  }
@@ -142,6 +142,9 @@ class ASwapDispatcher extends EventDispatcher {
142
142
  let body = this.getTagFromResult(result, "body");
143
143
  if (!body) {
144
144
  this.warning("AS problem - body was not found in result");
145
+ if (this.refreshOnContentParseError) {
146
+ window.location.reload();
147
+ }
145
148
  return false;
146
149
  }
147
150
  let html = document.createElement('html');
@@ -58,8 +58,14 @@ class WebflowListView extends View {
58
58
  delay = delay + (propsShow.tween.delay || 0);
59
59
  gsap.killTweensOf(el);
60
60
  gsap.set(el, {...propsInitial.tween});
61
- gsap.to(el, {duration: propsShow.time, ...propsShow.tween, delay});
62
- el.classList.add(CLASS_NAME_WEBSCROLL_FIRED);
61
+ gsap.to(el, {
62
+ duration: propsShow.time,
63
+ ...propsShow.tween,
64
+ delay,
65
+ onComplete: () => {
66
+ el.classList.add(CLASS_NAME_WEBSCROLL_FIRED);
67
+ }
68
+ });
63
69
  }
64
70
  }
65
71
  /**
@@ -205,8 +205,13 @@ class WebflowView extends View {
205
205
  if (e.scrollDirection === "FORWARD") {
206
206
  gsap.killTweensOf(el);
207
207
  gsap.set(el, {...propsInitial.tween});
208
- gsap.to(el, {duration: propsShow.time, ...propsShow.tween});
209
- el.classList.add(CLASS_NAME_WEBSCROLL_FIRED);
208
+ gsap.to(el, {
209
+ duration: propsShow.time,
210
+ ...propsShow.tween,
211
+ onComplete: () => {
212
+ el.classList.add(CLASS_NAME_WEBSCROLL_FIRED);
213
+ }
214
+ });
210
215
  }
211
216
  });
212
217
  scene.addTo(scrollController.get());