I want to use my own pre and next buttons and it is out of the slider div too. I am using BxSlider. I will share my code a bit. I will be glad if you can help this out.
This is the buttons and slides.
<div class= "productsbuttons"><img id ="proprev" src="images/productleftarrow.png" /><img style="margin-left:10px;" id="pronext" src="images/productrightarrow.png" /> </div>
</div>
<div class = "products">
<ul class = "mainslider">
<li><img class = "productslider" src="images/menu-image/img1.png" /> Lores ASda</li>
<li><img class = "productslider" src="images/img1.png" /> ASDasdasd</li>
<li><img class = "productslider" src="images/menu-image/img1.png" /> ASd</li>
<li><img class = "productslider" src="images/img1.png" /> ASas</li>
</ul>
This is the jquery
$(document).ready(function() {
var mySlider = $('.mainslider').bxSlider({
nextSelector: '#pronext',
prevSelector: '#proprev',
prevText: '',
nextText: '',
minSlides: 2,
maxSlides: 2,
slideWidth: 360,
slideMargin: 5,
pager:false,
});
});
Add your image src
to nextText
like this:
nextText: '<img src="images/next.jpg" height="25" width="25"/>',
prevText: '<img src="images/previous.jpg" height="25" width="25"/>'
Working JSFiddle of an working example:
you can try this code below. This should work.
$(document).ready(function(){
var slider = $('.mainslider').bxSlider({
minSlides: 2,
maxSlides: 2,
slideWidth: 360,
slideMargin: 5,
pager:false,
});
$('#pronext').click(function(){
slider.goToNextSlide();
return false;
});
$('#proprev').click(function(){
slider.goToPrevSlide();
return false;
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With