jquery – jQuey Popup no longer working

Question

I’m guessing this may be something to do with WordPress 5.5 but a little code snippet in one of my pages no longer works. To enable a little popup I used…

echo ub_modal('response-popup', 'lg', $_SESSION['ub_modal_header'] , $_SESSION['ub_modal_headercolour'], $_SESSION['ub_modal_content']);
    <script>
    (function($){
        $(document).ready(function() {
             $(".response-popup").modal("show");
        });
     })(jQuery);
    </script>

function ub_modal($name, $size, $header, $headercolour, $content){
    if($size =='sm'){$size="<div class="modal-dialog modal-sm">";} else {$size="<div class="modal-dialog modal-lg">";}

    $ub_modal="<div class="fusion-modal modal fade modal-1 " . $name . '" tabindex="-1" role="dialog" aria-labelledby="modal-heading-1" aria-hidden="true">';
    $ub_modal .= '<style type="text/css">.modal-1 .modal-header, .modal-1 .modal-footer{border-color:#ebebeb;}</style>';
    $ub_modal .= $size;
    $ub_modal .= '<div class="modal-content fusion-modal-content" style="background-color:#f6f6f6">';
    $ub_modal .= '<div class="modal-header">';
    $ub_modal .= '<button class="close" type="button" data-dismiss="modal" aria-hidden="true">&times;</button>';
    $ub_modal .= '<h3 class="modal-title" id="modal-heading-1" data-dismiss="modal" aria-hidden="true" style="color:' . $headercolour . '">' . $header . '</h3>';
    $ub_modal .= '</div><div class="modal-body fusion-clearfix">';     
    $ub_modal .= '<div id="content">' . $content . '</div></div>';
    $ub_modal .= '<div class="modal-footer"><a class="fusion-button button-default button-medium button default medium" data-dismiss="modal">Close</a></div>';
    $ub_modal .= '</div></div></div>';
    return $ub_modal;
    
}

I now get an error – Uncaught TypeError: $(…).modal is not a function.

I’m using Avada Theme Fusion. Can someone let me know if this is WP5.5 jQuery issue and if so, how can I make this work again? BTW, I’m no programmer so please don’t be too harsh 😉

0
Ian Turner 3 weeks 2021-07-06T11:17:17-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse