The problem is that pagerCustom
not for use with dynamic carousels:
[...] Not for use with Dynamic Carousels.
And also that the Pager does not match the number of slides, but the number of pages. One option is to use callback buildPager
:
buildPager: function ( slideIndex ) {
var img_pager = 'http://dummyimage.com/50x50/aaa/fff&text=' + (slideIndex + 1);
return '<img class="img-pager" src="' + img_pager + '" />';
}
$('.bxslider').bxSlider({
slideWidth: 300,
minSlides: 3,
maxSlides: 3,
moveSlides: 3,
slideMargin: 10,
pager: true,
pagerType: 'full',
buildPager: function (slideIndex) {
var img_pager = 'http://dummyimage.com/25x25/aaa/fff&text=' + (slideIndex + 1);
return '<img class="img-pager" src="' + img_pager + '" />';
}
});
.bx-pager-item {
margin: 0 5px;
}
.bx-wrapper .bx-pager, .bx-wrapper .bx-controls-auto {
bottom: -40px !important; /* só aqui no stacksnippet */
}
<link href="https://cdn.rawgit.com/stevenwanderski/bxslider-4/master/jquery.bxslider.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/stevenwanderski/bxslider-4/master/jquery.bxslider.min.js"></script>
<div class="bxslider">
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar1" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar2" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar3" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar4" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar5" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar6" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar7" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar8" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar9" />
</div>
<div class="slide">
<img src="http://placehold.it/300x150&text=FooBar10" />
</div>
</div>
Since you are pulling images from the BD via, one option is to create a JS object in the loop while
(untested):
<script> var pager_images = [
<?php
$i = 0;
while ( $img = mysql_fetch_array($query_fotos) ) {
if( $i % 3 == 0 ) { // imprime 1x a cada 3 passagens do loop
echo "'" . $img['foto'] . "', "; // IMPRIME 'http://url-da-foto',
}
$i++;
}
?>
];
</script>
And in the buildPager
:
var img_pager = pager_images[slideIndex];
The best tip I can give you is to look for another plugin, the bx slider of the very problem, it is very unstable, use it means go to sleep with the animation working and wake up with it all wrong inexplicably
– RodrigoBorth
This happens because you did not put the "items", which would be the elements inside the element with the class
bx-pager
. Try something like<div class="bx-pager"><span><?php
.– ptkato