M
M
malayamarisha2020-07-28 13:51:38
WordPress
malayamarisha, 2020-07-28 13:51:38

Why might the baguetteBox not work?

Good day!
In the WP theme, you need to connect the baguetteBox
In the functions.php file, you connect to the baguetteBox:

function flowers_scripts() {
  wp_enqueue_style( 'flowers-style', get_stylesheet_uri(), array(), _S_VERSION );
    wp_enqueue_style( 'flowers-bootstrap-css', get_template_directory_uri().'/assets/bootstrap/css/bootstrap.min.css', array(), _S_VERSION );
    wp_enqueue_style( 'flowers-googlefonts-css', 'https://fonts.googleapis.com/css2?family=Montserrat:[email protected];500&family=Nunito+Sans&display=swap', array(), _S_VERSION );
    wp_enqueue_style( 'flowers-baguetteBox-css', get_template_directory_uri().'/assets/css/baguetteBox.min.css', array(), _S_VERSION );
    wp_enqueue_style( 'flowers-style-css', get_template_directory_uri().'/assets/css/style.css', array(), _S_VERSION );
    wp_deregister_script('jquery');
    wp_register_script('jquery',get_template_directory_uri().'/assets/js/jquery-3.5.1.min.js');
    wp_enqueue_script('jquery');
    wp_enqueue_script( 'flowers-popper-js', get_template_directory_uri() . '/assets/js/popper.min.js', array(), '', true );
    wp_enqueue_script( 'flowers-bootstrap-js', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', array(), '', true );
    wp_enqueue_script( 'flowers-baguetteBox-js', get_template_directory_uri() . '/assets/js/baguetteBox.min.js', array(), '', true );
    wp_enqueue_script( 'flowers-main-js', get_template_directory_uri() . '/assets/js/main.js', array(), '', true );
    wp_enqueue_script( 'flowers-fontawesome-js', 'https://kit.fontawesome.com/7b292b2c1c.js', array(), '', true );
  if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    wp_enqueue_script( 'comment-reply' );
  }
}
add_action( 'wp_enqueue_scripts', 'flowers_scripts' );

In the main.js script I write
jQuery(function($){
    $(document).ready(function () {
    baguetteBox.run('.wp-block-gallery');
});

There are no errors in the console, but when clicking on the image in the post, the image does not open in the popup window.
In another topic, I connected without problems, everything was done by analogy. All the necessary files for the baguetteBox to work are there.
Tell me, please, what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vika Marmeladka, 2020-12-21
@homsi959

Look for classes or identifiers that can affect it. Perhaps one of them in css breaks his work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question