2

I am trying to reuse the bxslider javascript that gets installed in a plugin.

The page I am working on has this basic structure:

SLIDER <-- configured in a plugin

SLIDER OF WOOCOMMERCE OFFERS <-- list of offers comes from woocommerce

SLIDER <-- configured in a plugin

I am actually using bxslider. The woocommerce gives me actually a list of offers, so I'd like them to trigger bxslider for them. with a simple

 $('.products').bxSlider({
    });

So i am trying in the functions.php

wp_enqueue_script( 'main', get_template_directory_uri() . '/js/main.js', array('jquery','bxslider'), '20151215', true );

Actually I only get a .bxslider() is not a function javascript ERROR.

I also tried to include bxslider additionally as a javascript including dependencies, but the error stays the same...

1 Answer 1

0

var j = jQuery.noConflict();

    j(document).ready(function() 
    {
       j('.products').bxSlider({
       });

    });

Did the trick! & including bxslider.js in wp_enqueue with jquery dependency before the main

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.