using external javascript files in a content slider?

temporary site in question: www.bitterobscurity.com
The last content slider on the home page - reviews - contains an external call to a javascript function which is supposed to pull in various reviews.

As you can see, it’s not rendering correctly.
At first, I thought it was the way the js was interacting w/ my WP install.

So I put the same code on a “standard” wordpress page, and it works correctly.
See http://www.bitterobscurity.com/contact-us/ for how the page is supposed to render.

If it helps, here’s the code I’m using in the content slider:

<script type="text/javascript" src="http://static.weddingwire.com/static/js/widgets/myReviews.js"></script><div id="ww-widget-reviews" class="ww-reset ww-reviews-widget"><div class="ww-reviews-placeholder">Read all of our <a target="_new" href="http://www.weddingwire.com/biz/total-image-hair-airbrush-makeup-lombard/c84f4bbc8aa544fc.html">Wedding Hair & Makeup Reviews</a> at <a target="_new" href="http://www.weddingwire.com"><img src="http://static.weddingwire.com/static/images/logo/WWlogo-83x19.gif" alt="Weddings, Wedding Cakes,  Wedding Planning, Wedding Checklists, Free Wedding Websites, Wedding Dresses, Wedding Ideas & more"/></a></div></div><script type="text/javascript"><!--
WeddingWire.createReview({"vendorId":"c84f4bbc8aa544fc", "id":"ww-widget-reviews"});
--></script>

Any ideas on what, if anything, I can do to get the reviews to render correctly in a content slider?
Or barring that, any suggestions on how to accomplish something similar?

I’m willing to roll my sleeves up and get my fingers dirty with code if it will help.

Appreciate any assistance!

Hey Brad,

I have already assigned someone from the team to assist you with the issue.

Ben

Hi Brad,

I did some testing and I know what the issue is, but I’m struggling to find a fix. I’ll look into it further and let you know what I come up with.

Justin

Hi Brad,

The issue is that the slider makes a clone of the first and last slides so it can loop. The wedding wire script is only running in the clone and not the actual slide. There’s no way around the clone, but I was able to modify the script so it will now run on the actual slide. Give that a shot and let me know how it goes.

<script> setTimeout( function() { if ( 'undefined' == typeof WeddingWireInit ) { WeddingWireInit = true; jQuery( '.fl-slide.bx-clone #ww-widget-reviews' ).remove(); WeddingWire.createReview({"vendorId":"c84f4bbc8aa544fc", "id":"ww-widget-reviews"}); } }, 500 ); </script><script type="text/javascript" src="http://static.weddingwire.com/static/js/widgets/myReviews.js"></script><div id="ww-widget-reviews" class="ww-reset ww-reviews-widget"><div class="ww-reviews-placeholder">Read all of our <a target="_new" href="http://www.weddingwire.com/biz/total-image-hair-airbrush-makeup-lombard/c84f4bbc8aa544fc.html">Wedding Hair & Makeup Reviews</a> at <a target="_new" href="http://www.weddingwire.com"><img src="http://static.weddingwire.com/static/images/logo/WWlogo-83x19.gif" alt="Weddings, Wedding Cakes, Wedding Planning, Wedding Checklists, Free Wedding Websites, Wedding Dresses, Wedding Ideas & more"/></a></div></div>

Justin

Hi Justin - It’s ~kinda~ working… the review section in preview mode looked correct, but BB had a hard time saving the change.
After I make your suggested edit and save out of the content editor, I get that animated “updating bar” which stays on screen forever.
When I did a browser refresh, all the slides were duplicated.
Pressing forward, I hit done > publish changes, the dups are gone, but the review slide is all mangled again - which almost makes me think your suggested change wasn’t saved correctly? Dunno.

Just for grins, I made reviews the third slide in the stack, rather than the last one - but same problem.

I really appreciate you taking the time to help me out. If you can think of anything else, please let me know.

In the interim, I ~think~ I might give slidedeck2 a whirl to see if it works any better.

Thanks again for the quick reply!
I’m open to other suggestions if you want to bang your head against the wall some more :slight_smile:

Brad

Hi Brad,

I tested the code again and it looks like it’s only working sometimes. It may be that this slider (bxSlider) isn’t going to work in this case. Were you able to give slidedeck2 a try?

Justin

Hi Justin -
Yeah… I tried slidedeck2, and it worked OKish, but not sure that’s the direction I’m going to take. Not to mention my SD2 subscription will expire soon and I doubt I’ll renew it.

For now, the reviews code is in it’s own separate BB text block (and it’s working fine there).
I think I’m going to talk to the client about keeping it separate from the silder, as the reviews are too important to “hide” like that - doubt she’ll put up much fuss.

Anyway, thanks again for all your help - it’s really and truly appreciated.
You guys are the best - keep up the awesome work :slight_smile:

If you want/need to close this thread, feel free.

Thanks again,
Brad

Hey Brad,

You’re welcome! I would agree, that’s probably the best spot for it since reviews are so important. Let me know if they don’t buy that and we can bang our heads against this a little more :wink:

Justin