简体   繁体   中英

WordPress popup without plugin

<div>
<?php do_action( 'opalestate_member_login_form' ); ?>
 <a href="#opalestate-user-form-popup" class="opalestate-need-login button btn btn-primary btn-3d">
            <?php esc_html_e( 'Login', 'opalestate-pro' ) ?>
        </a>
    </div>

This code shows up a popup on button click. But i need help to show auto popup on page. without clicking any button.(WordPress)

You can use jquery to run button click event when the page loaded. Add this code into your page that popup is there.

 $(function(){ $('.opalestate-need-login').trigger('click'); })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM