Javascript Events when opening settings form

About this forum
These forums have not been active for several years. They're available for search and reference, but a lot of this information is likely out of date.

For current information, try visiting our Knowledge Base.

Home / Support / Custom Module Development / Javascript Events when opening settings form

This topic is: not resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #109470

    Didou
    Participant

    Are there any javascript events is triggered whenever a module-settings panel is opened?

    I’m trying to add some custom classes to the fl-lightbox and tabs to provide some extra width when using a custom module. It works when adding the class manually but would be nice to just add them when the form is triggered.

    I tried using the

    $( '.fl-builder-content' ).on( 'fl-builder.layout-rendered', myCallbackFunction );

    and

    $( '.fl-builder-content' ).on( 'fl-builder.preview-rendered', myCallbackFunction );

    but these are only called once and the form is created this event.

    Thanks.

    #109493

    Didou
    Participant

    I got it working by adding jquery plugin called onMutate:
    https://github.com/eclecto/jQuery-onMutate/

    In my bb-plugin I enqueue scripts and css

    wp_enqueue_script( 'bbjquery_mutate', BBEXTRA_MODULES_URL .'jquery.onmutate.js', array( 'jquery' ), '1.0.0' );
    wp_enqueue_script( 'bbextra_js', BBEXTRA_MODULES_URL .'add_width.js', array( 'jquery' ), '1.0.0' );
    wp_enqueue_style( 'bbextra_css', BBEXTRA_MODULES_URL .'add_width.css', 1, 1, 'all' );

    In my add_width.js I check for creation of .fl-lightbox-header element which basically means a new settings window is created. After that I add the class to a few elements and reset position of the fl-lightbox element to the center of the screen.

    I can now have a settings-window that accommodates a larger wysiwyg-editor.

    Please let me know if I could have done this differently, but it seemed worth the trouble to get this working this way.

    #109561

    Justin Busa
    Keymaster

    Hey Didou,

    I’m glad to hear you got it working. There’s no good way built-in to hook into a settings lightbox open event, but we can add one if needed. All of our events are delegates, so we’ve never needed that, but let me know if you do.

    Thanks!
    Justin

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Custom Module Development’ is closed to new topics and replies.