admin管理员组文章数量:1277875
I'm using jQuery with the bxSlider plugin, here is the link to it just incase: /
I'm trying to reload the slider and my custom pager after I've removed certain slides from it.
Here is what I have tried:
$(function() {
var slider = $('#slider').bxSlider({
pagerCustom: '#bx-pager'
});
$('.list').on('click', '.delete', function() {
image = $(this).closest('li').find('[type="hidden"]');
// image.attr('id') contains a string: image-0, image-1, image-2, etc.
$('#slider, #bx-pager').find('.' + image.attr('id')).remove();
slider.reloadSlider({
pagerCustom: '#bx-pager'
}); // I have also tried: slider.reloadSlider();
});
});
It works partially. What happens is the slider gets reloaded just fine but it removes the pager pletely when it runs the reload.
Thank you very much for any help.
I'm using jQuery with the bxSlider plugin, here is the link to it just incase: http://bxslider./
I'm trying to reload the slider and my custom pager after I've removed certain slides from it.
Here is what I have tried:
$(function() {
var slider = $('#slider').bxSlider({
pagerCustom: '#bx-pager'
});
$('.list').on('click', '.delete', function() {
image = $(this).closest('li').find('[type="hidden"]');
// image.attr('id') contains a string: image-0, image-1, image-2, etc.
$('#slider, #bx-pager').find('.' + image.attr('id')).remove();
slider.reloadSlider({
pagerCustom: '#bx-pager'
}); // I have also tried: slider.reloadSlider();
});
});
It works partially. What happens is the slider gets reloaded just fine but it removes the pager pletely when it runs the reload.
Thank you very much for any help.
Share Improve this question asked Aug 1, 2013 at 8:05 adamjadamj 4,7926 gold badges51 silver badges60 bronze badges 1- Same issue here. Have you found any solution? – Michele Gargiulo Commented Aug 9, 2013 at 8:53
1 Answer
Reset to default 11As long as I see, this is a bug in bxSlider, in fact, when you call the reloadSlider
method, internally are called the methods destroySlider
and init
.
In the destroySlider
method the pagerEl
element is destroyed, this is right if you are not using a custom one, because it is recreated programmatically in the init
method, but if you are using a custom one it can't be recreated programmatically.
I ended up modifying the destroySlider
method to check if a custom pager is used, in this case it must not be deleted.
Here is the before (line 1294):
if(slider.pagerEl) slider.pagerEl.remove();
And after:
if (slider.settings.pagerCustom === '') {
if(slider.pagerEl) slider.pagerEl.remove();
}
I'll post the bug on GitHub as soon as I have the time.
本文标签: javascriptjQuerybxSlider plugin reloadSlider issuesStack Overflow
版权声明:本文标题:javascript - jQuery - bxSlider plugin reloadSlider issues - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741277443a2369811.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论