@widelab-nc/widelab 1.1.7 → 1.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widelab-nc/widelab",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Widelab starter template based on Finsweet template + add-ons.",
5
5
  "homepage": "https://widelab.co",
6
6
  "license": "ISC",
package/src/index.js CHANGED
@@ -18,6 +18,25 @@ function customGsapEasing() {
18
18
 
19
19
  // Functions definitions
20
20
 
21
+ // Contact form open animation
22
+ let contactFormOpen;
23
+ function contactFormOpenAnimation() {
24
+ const contactFormWrapper = document.querySelector('.contact-modal_main-wrapper');
25
+ const contactForm = document.querySelector('.contact-modal_content-wrapper');
26
+ contactFormOpen = gsap.timeline({paused: true});
27
+ contactFormOpen.to(contactFormWrapper, {
28
+ autoAlpha: 1,
29
+ duration: 0.2,
30
+ ease: 'loader2',
31
+ })
32
+ contactFormOpen.from(contactForm, {
33
+ x: '100%',
34
+ duration: 0.3,
35
+ ease: 'loader2',
36
+ })
37
+ }
38
+
39
+
21
40
  //Smooth scroll init
22
41
  const lenis = new Lenis({
23
42
  duration: 1.2,
@@ -978,6 +997,43 @@ window.updateScrollTrigger = function() {
978
997
  });
979
998
  }
980
999
 
1000
+ // Custom checkboxes
1001
+ window.changeCheckboxLabelColor = function() {
1002
+ var checkboxInputs = document.querySelectorAll('.w-checkbox-input');
1003
+
1004
+ var callback = function(mutationsList, observer) {
1005
+ for(var mutation of mutationsList) {
1006
+ if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
1007
+ var isChecked = mutation.target.classList.contains('w--redirected-checked');
1008
+ var siblingLabel = mutation.target.parentElement.querySelector('.form-checkbox_label');
1009
+
1010
+ if (isChecked && siblingLabel && !siblingLabel.classList.contains('is-active')) {
1011
+ siblingLabel.classList.add('is-active');
1012
+ } else if (!isChecked && siblingLabel && siblingLabel.classList.contains('is-active')) {
1013
+ siblingLabel.classList.remove('is-active');
1014
+ }
1015
+ }
1016
+ }
1017
+ };
1018
+
1019
+ checkboxInputs.forEach(function(checkboxInput) {
1020
+ var config = { attributes: true, attributeFilter: ['class'] };
1021
+ var observer = new MutationObserver(callback);
1022
+ observer.observe(checkboxInput, config);
1023
+ });
1024
+
1025
+ }
1026
+
1027
+ // Contact modal open animation
1028
+ window.openContactModal = function() {
1029
+ contactFormOpen.play();
1030
+ }
1031
+
1032
+ // Contact modal close animation
1033
+ window.closeContactModal = function() {
1034
+ contactFormOpen.reverse(2);
1035
+ }
1036
+
981
1037
 
982
1038
  // !!!!!!!!! Keep this Alpine init at the end !!!!!!!!!
983
1039
  window.Webflow ||= [];
@@ -999,7 +1055,8 @@ window.updateScrollTrigger = function() {
999
1055
  pageLoadAnimation();
1000
1056
  pageTransitionAnimation();
1001
1057
  customCursorOnClick();
1058
+ contactFormOpenAnimation();
1002
1059
  if (window.innerWidth < 992) {
1003
1060
  disableScrollMenu();
1004
- }
1061
+ };
1005
1062
  });