News
We Go Season 2 Episode 6: The Path to The Eddie
Shop The Story
{"id":8047520350343,
"handle":"ahi-mens-boat-shoes-ash-sterling",
"title":"‘Ahi - Ash \/ Sterling",
"available":true,
"tags":["ahi","arch:standard","Beach\/Boat","best:beach_boat","boat","boat ahoe","boat shoe","boaters","boatshoes","cat:shoes","drop-in heel®","fisherman","fisherman shoe","fishing","fishing shoe","fit:standard","free shipping","gender:men","landtextile","material:textilemens","men's","RGroup_10554","shoes","size:true","sneakers","split_color","style:10554","swim shoes","water friendly shoe","water resisitant","water resistant","water-friendly","waterboat","watershoe","watershoes"],
"type":"Men’s Performance Marine Shoe",
"options_with_values": [{"name":"Color","position":1,"values":["Ash \/ Sterling"]},{"name":"Size","position":2,"values":["7","8","8.5","9","9.5","10","10.5","11","11.5","12","13","14","15"]}],
"price":18000,
"price_min":18000,
"price_max":18000,
"compare_at_price":null,"featured_image": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_001_M_AHI_AshSterling.png?v=1741308464",
"featured_image_aspect_ratio": 1.0,
"featured_image_width": 2000,
"featured_image_height": 2000,
"featured_image_id": 33819070169223,
"featured_image_alt": "Ash \/ Sterling",
"hover_image": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_103_678d4a23-4d9a-4869-a8b3-07fb9edcc30e.jpg?v=1744996484",
"hover_image_alt": "Ash \/ Sterling",
"images": [{
"id": 33819070169223,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_001_M_AHI_AshSterling.png?v=1741308464",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987411591,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_103_678d4a23-4d9a-4869-a8b3-07fb9edcc30e.jpg?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 1080,
"height": 1080
},{
"id": 34414987444359,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/Ahi_-_10554-AU6L_Ash_-_Sterling_1.jpg?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987477127,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_002_M_AHI_AshSterling_827409b1-c954-4365-a9f1-27adb436229e.png?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987509895,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_101_a19cc6b2-725f-4e24-ac06-069a5d4de2f4.jpg?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987542663,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_103_f8694666-9f7d-4d80-91ba-50acb488ba0e.jpg?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987575431,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/Ahi_-_10554-AU6L_Ash_-_Sterling_2.jpg?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987608199,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_003_M_AHI_AshSterling_2474c930-944d-4dd7-8e45-e3bc98b5f9d0.png?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987640967,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_102_a226a075-ae5a-46e6-9636-a1b6ccff0615.jpg?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987673735,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_104_d085b704-1682-4176-accc-cd7432d24a23.jpg?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 1080,
"height": 1080
},{
"id": 34414987706503,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_004_M_AHI_AshSterling_ab4e6c88-df8f-4e5d-93a5-5dc866ed6aef.png?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
},{
"id": 34414987739271,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/Ash-Wet_Grip.jpg?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 750,
"height": 750
},{
"id": 34414987772039,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10554_AU6L_005_M_AHI_AshSterling_0ccd2385-0c00-44b6-8840-dc258c816634.png?v=1744996484",
"alt": "Ash \/ Sterling",
"width": 2000,
"height": 2000
}],
"plp_image_order_positions": "",
"sku": "10554-AU6L-8"
}
{ $dispatch('product-item:images-changed', { product: product, source: 'swatch-container' }) })"
@pointercancel="intendedSwatchIndex = null; intendedSwatchEl = null"
x-data="{
wrapper: $el,
selectedSibling:product.siblings[0],
intendedSwatchIndex: null,
intendedSwatchEl: null,
swatchGap: 8,
scrollable: product.siblings.filter(s => !!s.available).length > 9.5,
canPrev: false,
canNext: true,
_edgeReady: false,
imageLimit: 0,
limitImages(nextProduct) {
const images = Array.isArray(nextProduct && nextProduct.images) ? nextProduct.images : [];
const limitedImages = this.imageLimit > 0 ? images.slice(0, this.imageLimit) : images;
const hoverImage = limitedImages[1] || null;
return Object.assign({}, nextProduct, {
images: limitedImages,
hover_image: hoverImage ? hoverImage.src : null,
hover_image_alt: hoverImage ? hoverImage.alt : null
});
},
selectProduct(nextProduct) {
const productRoot = $el.closest('.product-item');
const productData = productRoot && productRoot._x_dataStack && productRoot._x_dataStack[0];
if (productData && typeof productData.setProduct === 'function') {
productData.setProduct(nextProduct);
} else {
$data.product = this.limitImages(nextProduct);
}
},
getSwatchImageSrc(sibling) {
return sibling.images[0].src;
},
buildSwatchSrcset(src) {
if (!src) return '';
const widths = ['48', '96', '192'];
const separator = src.includes('?') ? '&' : '?';
return widths.map(w => `${src}${separator}width=${w} ${w}w`).join(', ');
},
isSwatchPriority(index) {
return window.innerWidth >= 1024 ? index < 3 : index < 2;
},
swatchBg(sibling) {
// swatch_bg precomputed at hydration. Nullish (not ||): null = no colors set
// (fall back to theme default), empty string = invalid combo, no fallback.
return sibling.swatch_bg ?? '#000000';
},
centerSwatch(el) {
if ($data.wrapper.scrollWidth <= $data.wrapper.clientWidth) return false
const wrapperRect = $data.wrapper.getBoundingClientRect()
const elRect = el.getBoundingClientRect()
const centerPoint = wrapperRect.x + (wrapperRect.width / 2)
const behavior = window.innerWidth < 1024 ? 'auto' : 'smooth'
$data.wrapper.scrollTo({
left: $data.wrapper.scrollLeft + (elRect.x - centerPoint + (elRect.width / 2)),
behavior
})
},
selectSwatchFromTap(siblingIndex, el) {
const idx = (this.intendedSwatchIndex !== null && this.intendedSwatchIndex !== undefined)
? this.intendedSwatchIndex
: siblingIndex
const targetEl = this.intendedSwatchEl || el
this.intendedSwatchIndex = null
this.intendedSwatchEl = null
const next = product.siblings[idx]
if (next) product = next
this.centerSwatch(targetEl)
},
scroll(direction = 'forward') {
const swatch = $data.wrapper.querySelector('.product-item__swatch')
const unit = swatch ? swatch.offsetWidth + $data.swatchGap : $data.wrapper.clientWidth * 0.3
let amount = 2 * unit
$data.wrapper.scrollTo({
left: direction == 'forward' ? $data.wrapper.scrollLeft + amount : $data.wrapper.scrollLeft - amount,
behavior:'smooth'
})
},
// Lazily wire the prev/next edge detection on first desktop hover/focus —
// the arrows are a desktop affordance, so no observer is built at load and
// none is ever built on mobile. canPrev/canNext default to the at-start state.
initSwatchEdges() {
if (this._edgeReady || window.innerWidth <= 1023) return
this._edgeReady = true
const root = this.wrapper
const swatches = root.querySelectorAll('.product-item__swatch')
if (swatches.length < 2) return
const first = swatches[0], last = swatches[swatches.length - 1]
const io = new IntersectionObserver((entries) => {
const d = window.Alpine && window.Alpine.$data ? window.Alpine.$data(root) : null
if (!d) return
entries.forEach((e) => {
if (e.target === first) d.canPrev = !e.isIntersecting
if (e.target === last) d.canNext = !e.isIntersecting
})
}, { root, threshold: 0.99 })
io.observe(first)
io.observe(last)
root._swatchEdgeIO = io
}
}"
@pointerenter="initSwatchEdges()"
@focusin="initSwatchEdges()"
>
{"id":8134359187591,
"handle":"makiki-mens-athletic-shoes-lava-rock-hla",
"title":"Makiki - Lava Rock \/ HLA",
"available":true,
"tags":["arch:standard","best sellers","best selling","best:everday_wear","best:travel","boat shoe","boatshoes","cat:shoes","color:blue","drop-in heel®","enhance gip","enhanced traction outsole","Everyday Wear","fit:standard","gender:men","labor day","landtextile","likes:beach","likes:exercising","likes:friends","likes:hiking","likes:relaxing","likes:urban-exploring","makiki","makiki olukai","makiki shoes for sea","material:textile","mens","mesh","no shoestring","RGroup_10567","shoes","size:true","sneakers","split_color","style:10567","swim","swim shoes","Travel","vegan","wide toed","wide width"],
"type":"Men’s Athletic Shoes",
"options_with_values": [{"name":"Color","position":1,"values":["Lava Rock \/ Hla"]},{"name":"Size","position":2,"values":["7","8","8.5","9","9.5","10","10.5","11","11.5","12","13","14","15"]}],
"price":18000,
"price_min":18000,
"price_max":18000,
"compare_at_price":null,"featured_image": "\/\/olukai.ca\/cdn\/shop\/files\/10567_LRHL_001_M_MAKIKI_LavaRockHLA.png?v=1759467645",
"featured_image_aspect_ratio": 1.0,
"featured_image_width": 2000,
"featured_image_height": 2000,
"featured_image_id": 35110507675783,
"featured_image_alt": "Lava Rock \/ HLA",
"hover_image": "\/\/olukai.ca\/cdn\/shop\/files\/10567-LRHL-203.jpg?v=1751319484",
"hover_image_alt": "Makiki - Lava Rock \/ HLA",
"images": [{
"id": 35110507675783,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567_LRHL_001_M_MAKIKI_LavaRockHLA.png?v=1759467645",
"alt": "Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35180884852871,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567-LRHL-203.jpg?v=1751319484",
"alt": "Makiki - Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35329075937415,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567-LRHL-101.jpg?v=1752190325",
"alt": "Makiki - Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35110507708551,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567_LRHL_003_M_MAKIKI_LavaRockHLA.png?v=1752190325",
"alt": "Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35180868796551,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567-LRHL-202.jpg?v=1752190325",
"alt": "Makiki - Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35329075347591,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567-LRHL-102.jpg?v=1752190325",
"alt": "Makiki - Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35110507741319,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567_LRHL_004_M_MAKIKI_LavaRockHLA.png?v=1752190325",
"alt": "Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35180885508231,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567-LRHL-201.jpg?v=1752190325",
"alt": "Makiki - Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35329075380359,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567-LRHL-103.jpg?v=1752190325",
"alt": "Makiki - Lava Rock \/ HLA",
"width": 2000,
"height": 2000
},{
"id": 35110507774087,
"src": "\/\/olukai.ca\/cdn\/shop\/files\/10567_LRHL_005_M_MAKIKI_LavaRockHLA.png?v=1752190325",
"alt": "Lava Rock \/ HLA",
"width": 2000,
"height": 2000
}],
"plp_image_order_positions": "",
"sku": "10567-LRHL-7"
}
{ $dispatch('product-item:images-changed', { product: product, source: 'swatch-container' }) })"
@pointercancel="intendedSwatchIndex = null; intendedSwatchEl = null"
x-data="{
wrapper: $el,
selectedSibling:product.siblings[0],
intendedSwatchIndex: null,
intendedSwatchEl: null,
swatchGap: 8,
scrollable: product.siblings.filter(s => !!s.available).length > 9.5,
canPrev: false,
canNext: true,
_edgeReady: false,
imageLimit: 0,
limitImages(nextProduct) {
const images = Array.isArray(nextProduct && nextProduct.images) ? nextProduct.images : [];
const limitedImages = this.imageLimit > 0 ? images.slice(0, this.imageLimit) : images;
const hoverImage = limitedImages[1] || null;
return Object.assign({}, nextProduct, {
images: limitedImages,
hover_image: hoverImage ? hoverImage.src : null,
hover_image_alt: hoverImage ? hoverImage.alt : null
});
},
selectProduct(nextProduct) {
const productRoot = $el.closest('.product-item');
const productData = productRoot && productRoot._x_dataStack && productRoot._x_dataStack[0];
if (productData && typeof productData.setProduct === 'function') {
productData.setProduct(nextProduct);
} else {
$data.product = this.limitImages(nextProduct);
}
},
getSwatchImageSrc(sibling) {
return sibling.images[0].src;
},
buildSwatchSrcset(src) {
if (!src) return '';
const widths = ['48', '96', '192'];
const separator = src.includes('?') ? '&' : '?';
return widths.map(w => `${src}${separator}width=${w} ${w}w`).join(', ');
},
isSwatchPriority(index) {
return window.innerWidth >= 1024 ? index < 3 : index < 2;
},
swatchBg(sibling) {
// swatch_bg precomputed at hydration. Nullish (not ||): null = no colors set
// (fall back to theme default), empty string = invalid combo, no fallback.
return sibling.swatch_bg ?? '#000000';
},
centerSwatch(el) {
if ($data.wrapper.scrollWidth <= $data.wrapper.clientWidth) return false
const wrapperRect = $data.wrapper.getBoundingClientRect()
const elRect = el.getBoundingClientRect()
const centerPoint = wrapperRect.x + (wrapperRect.width / 2)
const behavior = window.innerWidth < 1024 ? 'auto' : 'smooth'
$data.wrapper.scrollTo({
left: $data.wrapper.scrollLeft + (elRect.x - centerPoint + (elRect.width / 2)),
behavior
})
},
selectSwatchFromTap(siblingIndex, el) {
const idx = (this.intendedSwatchIndex !== null && this.intendedSwatchIndex !== undefined)
? this.intendedSwatchIndex
: siblingIndex
const targetEl = this.intendedSwatchEl || el
this.intendedSwatchIndex = null
this.intendedSwatchEl = null
const next = product.siblings[idx]
if (next) product = next
this.centerSwatch(targetEl)
},
scroll(direction = 'forward') {
const swatch = $data.wrapper.querySelector('.product-item__swatch')
const unit = swatch ? swatch.offsetWidth + $data.swatchGap : $data.wrapper.clientWidth * 0.3
let amount = 2 * unit
$data.wrapper.scrollTo({
left: direction == 'forward' ? $data.wrapper.scrollLeft + amount : $data.wrapper.scrollLeft - amount,
behavior:'smooth'
})
},
// Lazily wire the prev/next edge detection on first desktop hover/focus —
// the arrows are a desktop affordance, so no observer is built at load and
// none is ever built on mobile. canPrev/canNext default to the at-start state.
initSwatchEdges() {
if (this._edgeReady || window.innerWidth <= 1023) return
this._edgeReady = true
const root = this.wrapper
const swatches = root.querySelectorAll('.product-item__swatch')
if (swatches.length < 2) return
const first = swatches[0], last = swatches[swatches.length - 1]
const io = new IntersectionObserver((entries) => {
const d = window.Alpine && window.Alpine.$data ? window.Alpine.$data(root) : null
if (!d) return
entries.forEach((e) => {
if (e.target === first) d.canPrev = !e.isIntersecting
if (e.target === last) d.canNext = !e.isIntersecting
})
}, { root, threshold: 0.99 })
io.observe(first)
io.observe(last)
root._swatchEdgeIO = io
}
}"
@pointerenter="initSwatchEdges()"
@focusin="initSwatchEdges()"
>
{ $dispatch('product-item:images-changed', { product: product, source: 'swatch-container' }) })"
@pointercancel="intendedSwatchIndex = null; intendedSwatchEl = null"
x-data="{
wrapper: $el,
selectedSibling:product.siblings[0],
intendedSwatchIndex: null,
intendedSwatchEl: null,
swatchGap: 8,
scrollable: product.siblings.filter(s => !!s.available).length > 9.5,
canPrev: false,
canNext: true,
_edgeReady: false,
imageLimit: 0,
limitImages(nextProduct) {
const images = Array.isArray(nextProduct && nextProduct.images) ? nextProduct.images : [];
const limitedImages = this.imageLimit > 0 ? images.slice(0, this.imageLimit) : images;
const hoverImage = limitedImages[1] || null;
return Object.assign({}, nextProduct, {
images: limitedImages,
hover_image: hoverImage ? hoverImage.src : null,
hover_image_alt: hoverImage ? hoverImage.alt : null
});
},
selectProduct(nextProduct) {
const productRoot = $el.closest('.product-item');
const productData = productRoot && productRoot._x_dataStack && productRoot._x_dataStack[0];
if (productData && typeof productData.setProduct === 'function') {
productData.setProduct(nextProduct);
} else {
$data.product = this.limitImages(nextProduct);
}
},
getSwatchImageSrc(sibling) {
return sibling.images[0].src;
},
buildSwatchSrcset(src) {
if (!src) return '';
const widths = ['48', '96', '192'];
const separator = src.includes('?') ? '&' : '?';
return widths.map(w => `${src}${separator}width=${w} ${w}w`).join(', ');
},
isSwatchPriority(index) {
return window.innerWidth >= 1024 ? index < 3 : index < 2;
},
swatchBg(sibling) {
// swatch_bg precomputed at hydration. Nullish (not ||): null = no colors set
// (fall back to theme default), empty string = invalid combo, no fallback.
return sibling.swatch_bg ?? '#000000';
},
centerSwatch(el) {
if ($data.wrapper.scrollWidth <= $data.wrapper.clientWidth) return false
const wrapperRect = $data.wrapper.getBoundingClientRect()
const elRect = el.getBoundingClientRect()
const centerPoint = wrapperRect.x + (wrapperRect.width / 2)
const behavior = window.innerWidth < 1024 ? 'auto' : 'smooth'
$data.wrapper.scrollTo({
left: $data.wrapper.scrollLeft + (elRect.x - centerPoint + (elRect.width / 2)),
behavior
})
},
selectSwatchFromTap(siblingIndex, el) {
const idx = (this.intendedSwatchIndex !== null && this.intendedSwatchIndex !== undefined)
? this.intendedSwatchIndex
: siblingIndex
const targetEl = this.intendedSwatchEl || el
this.intendedSwatchIndex = null
this.intendedSwatchEl = null
const next = product.siblings[idx]
if (next) product = next
this.centerSwatch(targetEl)
},
scroll(direction = 'forward') {
const swatch = $data.wrapper.querySelector('.product-item__swatch')
const unit = swatch ? swatch.offsetWidth + $data.swatchGap : $data.wrapper.clientWidth * 0.3
let amount = 2 * unit
$data.wrapper.scrollTo({
left: direction == 'forward' ? $data.wrapper.scrollLeft + amount : $data.wrapper.scrollLeft - amount,
behavior:'smooth'
})
},
// Lazily wire the prev/next edge detection on first desktop hover/focus —
// the arrows are a desktop affordance, so no observer is built at load and
// none is ever built on mobile. canPrev/canNext default to the at-start state.
initSwatchEdges() {
if (this._edgeReady || window.innerWidth <= 1023) return
this._edgeReady = true
const root = this.wrapper
const swatches = root.querySelectorAll('.product-item__swatch')
if (swatches.length < 2) return
const first = swatches[0], last = swatches[swatches.length - 1]
const io = new IntersectionObserver((entries) => {
const d = window.Alpine && window.Alpine.$data ? window.Alpine.$data(root) : null
if (!d) return
entries.forEach((e) => {
if (e.target === first) d.canPrev = !e.isIntersecting
if (e.target === last) d.canNext = !e.isIntersecting
})
}, { root, threshold: 0.99 })
io.observe(first)
io.observe(last)
root._swatchEdgeIO = io
}
}"
@pointerenter="initSwatchEdges()"
@focusin="initSwatchEdges()"
>
Explore Similar Stories
{ $dispatch('product-item:images-changed', { product: product, source: 'swatch-container' }) })"
@pointercancel="intendedSwatchIndex = null; intendedSwatchEl = null"
x-data="{
wrapper: $el,
selectedSibling:product.siblings[0],
intendedSwatchIndex: null,
intendedSwatchEl: null,
swatchGap: 8,
scrollable: product.siblings.filter(s => !!s.available).length > 9.5,
canPrev: false,
canNext: true,
_edgeReady: false,
imageLimit: 0,
limitImages(nextProduct) {
const images = Array.isArray(nextProduct && nextProduct.images) ? nextProduct.images : [];
const limitedImages = this.imageLimit > 0 ? images.slice(0, this.imageLimit) : images;
const hoverImage = limitedImages[1] || null;
return Object.assign({}, nextProduct, {
images: limitedImages,
hover_image: hoverImage ? hoverImage.src : null,
hover_image_alt: hoverImage ? hoverImage.alt : null
});
},
selectProduct(nextProduct) {
const productRoot = $el.closest('.product-item');
const productData = productRoot && productRoot._x_dataStack && productRoot._x_dataStack[0];
if (productData && typeof productData.setProduct === 'function') {
productData.setProduct(nextProduct);
} else {
$data.product = this.limitImages(nextProduct);
}
},
getSwatchImageSrc(sibling) {
return sibling.images[0].src;
},
buildSwatchSrcset(src) {
if (!src) return '';
const widths = ['48', '96', '192'];
const separator = src.includes('?') ? '&' : '?';
return widths.map(w => `${src}${separator}width=${w} ${w}w`).join(', ');
},
isSwatchPriority(index) {
return window.innerWidth >= 1024 ? index < 3 : index < 2;
},
swatchBg(sibling) {
// swatch_bg precomputed at hydration. Nullish (not ||): null = no colors set
// (fall back to theme default), empty string = invalid combo, no fallback.
return sibling.swatch_bg ?? '#000000';
},
centerSwatch(el) {
if ($data.wrapper.scrollWidth <= $data.wrapper.clientWidth) return false
const wrapperRect = $data.wrapper.getBoundingClientRect()
const elRect = el.getBoundingClientRect()
const centerPoint = wrapperRect.x + (wrapperRect.width / 2)
const behavior = window.innerWidth < 1024 ? 'auto' : 'smooth'
$data.wrapper.scrollTo({
left: $data.wrapper.scrollLeft + (elRect.x - centerPoint + (elRect.width / 2)),
behavior
})
},
selectSwatchFromTap(siblingIndex, el) {
const idx = (this.intendedSwatchIndex !== null && this.intendedSwatchIndex !== undefined)
? this.intendedSwatchIndex
: siblingIndex
const targetEl = this.intendedSwatchEl || el
this.intendedSwatchIndex = null
this.intendedSwatchEl = null
const next = product.siblings[idx]
if (next) product = next
this.centerSwatch(targetEl)
},
scroll(direction = 'forward') {
const swatch = $data.wrapper.querySelector('.product-item__swatch')
const unit = swatch ? swatch.offsetWidth + $data.swatchGap : $data.wrapper.clientWidth * 0.3
let amount = 2 * unit
$data.wrapper.scrollTo({
left: direction == 'forward' ? $data.wrapper.scrollLeft + amount : $data.wrapper.scrollLeft - amount,
behavior:'smooth'
})
},
// Lazily wire the prev/next edge detection on first desktop hover/focus —
// the arrows are a desktop affordance, so no observer is built at load and
// none is ever built on mobile. canPrev/canNext default to the at-start state.
initSwatchEdges() {
if (this._edgeReady || window.innerWidth <= 1023) return
this._edgeReady = true
const root = this.wrapper
const swatches = root.querySelectorAll('.product-item__swatch')
if (swatches.length < 2) return
const first = swatches[0], last = swatches[swatches.length - 1]
const io = new IntersectionObserver((entries) => {
const d = window.Alpine && window.Alpine.$data ? window.Alpine.$data(root) : null
if (!d) return
entries.forEach((e) => {
if (e.target === first) d.canPrev = !e.isIntersecting
if (e.target === last) d.canNext = !e.isIntersecting
})
}, { root, threshold: 0.99 })
io.observe(first)
io.observe(last)
root._swatchEdgeIO = io
}
}"
@pointerenter="initSwatchEdges()"
@focusin="initSwatchEdges()"
>