• Is there a way to trigger the modal using javascript? I tried using jQuery(‘.wow-modal-id-1’).click(); but it doesn’t work ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter apetruzzi

    (@apetruzzi)

    figured it out. the plugin doesn’t support this directly, so i had to hack the hell out of it. Basically what I’m doing is rather than trying to trigger the modal with javascript, I am creating a hidden div with the modal html code and then using jQuery to clone html code (with events) and move it where I wanted.

    first i added an action to wp_footer in my theme’s functions php that outputted a hidden div with an actual link calling the modal:

    functions.php
    ————-
    add_action( ‘wp_footer’, ‘my_modal_code’ );
    public function my_modal_code()
    {
    ?>
    <div style=”display:none;” id=”my_modal_code”>
    Open Modal
    </div>
    <?
    }

    Next I used jQuery to clone (with events) and move the html code where I want it.

    sc = jQuery(‘#my_modal_code’).clone(true);
    jQuery(‘#my_modal_code’).remove();
    jQuery(‘p’).prepend( sc.show() );

    Plugin Author Wow-Company

    (@wpcalc)

    Hello.

    Unfortunately, the current version of the plugin does not support calling a modal window through a function.

    Your decision has the right to life.

    If this function is needed, we can add it to future versions of the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘trigger via javascript’ is closed to new replies.