jonom/jquery-focuspoint

doesn't play well with ajaxified sites

Closed this issue · 1 comments

focuspoint doesn't have any "unfocus" method. on ajaxified site where content comes and goes there's no way to unbind focuspoint's "resize" handler so it'll stay forever trying to adjust non-existent containers.

the only workaround I see is to disable automatic adjust and trigger it manually for every "focuspointed" image in a single handwritten resize handler.

this also seems to be a good idea in case of multiple focuspointed images, since plugin creates separate resize handlers for each one of them. I wonder if this is any good for performance.

I think code structure should be different. You should have a single "resize" handler and an array of focuspointed elements, so calling $.fn.focuspoint would only add and remove elements from this array. And $(xxx).focuspoint({disable: true}) maybe?

@constb the latest update should help you out but feel free to submit a pull request if you want to take it further