FLTheme._bind() binds on resize without event namespace

I’m calling this a bug since other events are already bound with an fl-theme namespace:

In FLTheme._init() two handlers get bound to the window’s resize event. Since bxSlider also attaches tons of handlers this makes it impossible to override e.g. the default implementation of FLTheme._enableFixedHeader (which implements a hardcoded switch at < 992px).

It would be lovely if these handlers would also use the fl-theme namespace, or ideally a more specific namespace like fl-theme-enableFixedHeader.

In a perfect world though FLTheme would be a global object that would extend any existing FLTheme object and could be modified by other scripts. If that were the case, we could simply use e.g.:
$(window).off('resize', FLTheme._enableFixedHeader);

or even override the original implementation directly.

Just a thought. Thanks! :slight_smile:

Two corrections to the above suggestion:

  1. To unbind a specific handler, .unbind() has to be used (not .off()).
  2. The above example won't work anyway, since FLTheme._enableFixedHeader gets proxied through $.throttle.

In conclusion:

  1. Namespaces are still required, no matter if or how FLTheme can be accessed.
  2. A global FLTheme would still be awesome (for overriding implementations instead of having to deal with bound handlers).

Hey Fabian,

I’ve already assigned another member of the team to check on your concern. :slight_smile:

Ben

Hey Fabian,

Thanks for the suggestion. I don’t see why we can’t look into something like this. It should be fairly easy and backwards compatible. I’ve filed an issue on it.

Thanks,
Justin

Great, thanks! :slight_smile: