Why is bxslider duplicating my divs

user1899829 picture user1899829 · Nov 4, 2013 · Viewed 21.4k times · Source

My designer put a bxslider to scroll through 3 divs nicely on my page. When the page runs, in the html I see it generates 6 divs on the page. It shows div 3, div2, div1, div3, div2, div1.

Just because the duplicated fields on my page now mess up my programing.

Is that neccesary, and is there any way I can touch the code that it shouldn't duplicate my divs?

The page is full of complex code , with an ajax passing the data-serialize to a post form. Becuase it's all duplicated, now all fields are coming through as 'value,value'. Therefore it's not giving me accurate respones, and well as undefined when it's supposed to be numeric.

My form posts looks like this:

function submitCart () {
$.post(
"scripts/savecart.asp",
$("#form1").serialize()
);}

How could I add that not bx- to it?

Answer

antongorodezkiy picture antongorodezkiy · Jan 28, 2015

As commented in the source code of bxSlider:

if infinite loop, prepare additional slides

So I was able to fix this by adding infiniteLoop: false to the config object:

$(".js-slider").bxSlider({
    infiniteLoop: false
});