I'm trying to make some customization in a Shopify theme (the Brooklyn one). In this theme, there is a file theme.js.liquid
in which they define a very large function slate.Variants()
. Within this function, I defined another function filterSlidesOnMobile(variant)
and call it within the large function slate.Variants()
.
I want to call my function filterSlidesOnMobile(variant)
every time the windows resize. I tried to use jquery functions like resize()
and onresize()
within and out of slate.Variants()
but no sucess. The problem is my function has a parameter variant
which is defined in slate.Variants()
, so it's obvious that calling the resize out of it won't work, but even when calling the resize within it, there is syntax errors like when I do $(window).resize(this.filterSlidesOnMobile(variant));
, I get:
Uncaught SyntaxError: Unexpected token '.'
Where should I call the resize and how?
I precise that I'm new to Js and that any help will be greatly appreciated.
EDIT: As requested, here is a pastebin link to the function slate.Variants()
in which I did all my work.
Look up for lines 27 - 114 - 127 and 156. (This is what I added: except those lines, the theme file didn't change).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…