I have three <ul>that I want to combine and turn into a slider (I use bxslider ). This is something like ...
<div class="wrapper">
<ul class="products-grid">
<li>Product 1</li>
<li>Product 2</li>
<li>Product 3</li>
</ul>
<ul class="products-grid">
<li>Product 4</li>
<li>Product 5</li>
<li>Product 6</li>
</ul>
<ul class="products-grid">
<li>Product 7</li>
<li>Product 8</li>
<li>Product 9</li>
</ul>
</div>
When I execute the bottom lines of jQuery in the chrome console, one line at a time, everything works fine.
jQuery('ul.products-grid').children('li').appendTo('ul.products-grid:first');
jQuery('ul.products-grid').not(':first').remove();
jQuery('ul.products-grid').bxSlider({
slideWidth: 200,
minSlides: 1,
maxSlides: 3,
slideMargin: 10
});
But when I try to execute jQuery in the php / html template or in the Chrome console at the same time, only the first line is executed, and I stay with ...
<div class="wrapper">
<ul class="products-grid">
<li>Product 1</li>
<li>Product 2</li>
<li>Product 3</li>
<li>Product 4</li>
<li>Product 5</li>
<li>Product 6</li>
<li>Product 7</li>
<li>Product 8</li>
<li>Product 9</li>
</ul>
<ul class="products-grid">
</ul>
<ul class="products-grid">
</ul>
</div>
Any idea how I can fix this? This seems to be related to the code execution order.
UPDATE
I noticed that in the console, if I put a debugger just before the code runs, I get the following error after adding
.Uncaught ReferenceError: optionsPrice is not defined bundle.js 110
This should cause a conflict. Here is the full function from bundle.js
reloadPrice: function() {
var calculatedPrice = 0;
var dispositionPrice = 0;
var includeTaxPrice = 0;
for (var option in this.config.selected) {
if (this.config.options[option]) {
for (var i=0; i < this.config.selected[option].length; i++) {
var prices = this.selectionPrice(option, this.config.selected[option][i]);
calculatedPrice += Number(prices[0]);
dispositionPrice += Number(prices[1]);
includeTaxPrice += Number(prices[2]);
}
}
}
var event = $(document).fire('bundle:reload-price', {
price: calculatedPrice,
priceInclTax: includeTaxPrice,
dispositionPrice: dispositionPrice,
bundle: this
});
if (!event.noReloadPrice) {
optionsPrice.specialTaxPrice = 'true';
optionsPrice.changePrice('bundle', calculatedPrice);
optionsPrice.changePrice('nontaxable', dispositionPrice);
optionsPrice.changePrice('priceInclTax', includeTaxPrice);
optionsPrice.reload();
}
return calculatedPrice;
},
And in
there is a script tag that is.,<script type="text/javascript">
var bundle = new Product.Bundle({"options":{"98":{"selections":{"2307":{"qty":1,"customQty":"0","price":2.5,"priceInclTax":1.88,"priceExclTax":1.88,"priceValue":0,"priceType":"0","tierPrice":{"32000-7":{"price_id":"738","website_.......
.