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

Script stops working after an ajax call / reloading items #13

Closed
AntonShumin opened this issue Apr 13, 2017 · 1 comment
Closed

Script stops working after an ajax call / reloading items #13

AntonShumin opened this issue Apr 13, 2017 · 1 comment

Comments

@AntonShumin
Copy link

AntonShumin commented Apr 13, 2017

I am using an ajax call to reload the items that use tilt. (filtering and ordering by location for example).
The script removes all current items and generates new code, without reloading the page.
That causes tilt to stop working for the new items.

As a workaround i now send the vanilla tilt script with each ajax call, but it feels dirty.
I believe these can be solved by converting to delegate methods like .on("click".. instead of click(..)

image

@gijsroge
Copy link
Owner

Hi @AntonShumin

Thats because the elements are new and net yet binded to tilt.js. Just call .tilt() on those new elements. e.g. $('.ajax-wrapper .js-tilt').tilt(); the .ajax-wrapper has to be a wrapper element that is not replaced after the ajax call.

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

2 participants