Javascript Error "$ is not a function"

I’m currently converting a client’s old site to WordPress using BB and struggling to get reflection.js to create an image reflection at the bottom of each image in the BB Post Carousel on the Home page.

The images are supposed to be perfectly square but are showing rectangular at time times and at other times entirely askew. Not sure what the issue is but reflection.js is working fine on all Single Project pages:

http://ec2.3b1.mwp.accessdomain.com

At any rate, thought perhaps it might be a Javascript issue as I keep getting an error message in the Console on OS X/Chrome that indicates “$ is not a function” per the following screenshot:

https://s3.amazonaws.com/app.codeable.io/attachments/31781/screenshot-2016-02-04-at-03.23.26.png

It looks like the error is in a BB file, but I’m clueless regarding Javascript, so I wanted to check in and confirm whether or not this is/isn’t a BB issue?

Hey Shane,

Welcome to the BB forums! :slight_smile:

I’ll deal with the JS error first as the issue may all be related to that. :slight_smile:

So it seems this is from the jQuery code you added to the layout JS settings. Specifically, this…
$(".featured-projects img.fl-photo-img").addClass("reflect");
Can you change the $ sign to jQuery and see if that fixes the error?

Ben

Thanks for the warm welcome Ben. :wink: Would that be in this file?

http://ec2.3b1.mwp.accessdomain.com/wp-content/uploads/bb-plugin/cache/3-layout.js?ver=479bc98133d4fe9d2f49f71d6673bf56

If so, I’ve tried making the requested edit, but even after clearing the BB cache, database & flushing cache it doesn’t seem to have changed. Did I edit the wrong file?

Hi Shane,

Like Ben said, welcome to the BB forums!

Regarding the change to the code, you will want to make the change to the code itself and not edit that file.

So wherever you added the code with the class names for the carousel classes, is where you want to make the edit.

Thanks,
Danny

Thanks for the warm welcome as well Danny, you guys are great. :wink: Think I found it, forgot that I’d added that snippet via the Global Settings and just made the modification. Reflections are missing from some of the project images in the Home page slider, not sure why, some sort of conflict between reflection.js and the BB Post Carousel js?

Hi Shane,

I have checked your carousel again and all the images have a reflection. However, on the ones that don’t, it appears it is taking sometime for the reflect to appear. Once, loaded or cycled through all the images, the reflection appears on all of them for me anyway.

Can you provide a link to the script, so I can test this on my end, please?

Thanks,
Danny

Sure thing Danny, I found it here:

http://www.digitalia.be/software/reflectionjs-for-jquery/

Is that all you need?

Hi all, just wanted to check in and see if you need anything else from me? From some reason or other I see the reflections on the first four slides, but not in those that come after it: https://app.crossbrowsertesting.com/public/i955edfeea996749/livetests/4461131

Hey Shane,

I think the problem here is caused by how bxslider works. It generates clones of the slides to make it loop. Can you set Loop to No and see if you get the same problem?

Edit: Bxslider by the way is the jQuery slider we use to power up our Posts Carousel module. :slight_smile:

Ben

Thanks Ben, just changed loop to “No” and voila, no more issues with image reflections! Unfortunately my client wants the slides to rotate on a loop, can you suggest some sort of workaround for this?

Hey Shane,

Thanks for the feedback. I’ve already filed a bug report so our lead dev can check. :slight_smile:

Ben

Okay, thanks Ben!

Hey Shane,

I just got caught up on this thread and believe I might know what the solution is. Would it be possible to get temporary admin access to test my theory?

Thanks!
Justin

[Content Hidden]

Hey Shane,

You’re all set! I adjusted the JS for you and it should be working now.

Justin

Awesome, thanks a bunch Justin, you guys rock much appreciated!

Happy to hear the issue has been resolved, Shane and thanks for informing us!

Thanks,
Danny

You bet and big thanks to you guys, your support is awesome!