Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializing JS function from data-fred-on-drop not working. #465

Open
BigBlockStudios opened this issue Jan 23, 2023 · 1 comment
Open

Comments

@BigBlockStudios
Copy link

I'm trying to reinitialize Zurb Foundation interchange when an element is dropped into a dropzone. It does not appear to be working, I'm not getting any JS errors or otherwise. just "not happening"

<section id="hero" class="hero about background-cover align-items-end default-height" 
data-interchange="
[{{interchange_hero_small}}, small],
[{{interchange_hero_medium}}, medium],
[{{interchange_hero_large}}, large],
" 
data-fred-on-setting-change="reinitInterchange"
data-fred-on-drop="reinitInterchange">

  ........ some markup .......

</section>

I placed the reinit script in my app.js

`reinitInterchange();

function reinitInterchange()
{
console.log('reinitializing interchange')
}
`

I do get a log entry when the page loads, not when I drop the hero section into a dropzone.

Not sure what I can look at, the docs are pretty clear about just inserting a data attribute in the dropped markup.

@BigBlockStudios
Copy link
Author

My error, this does work as advertised. The error being I did not fully understand a "global" js script... This works.

window.reinitLazyInterchange = function() { console.log('init'); $('.reinitondrop').foundation().unveilInterchange(); }

Though is there an event when Fred initially loads? Would be useful for disabling things like lightbox galleries....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant