Triggering event on  when affix is changed

I need to trigger an event when affix is set or unset.