We know that there are @media queries
.
They work with CSS.
But I need to do with JavaScript.
I need bxSlider to work only on% w / o%.
We know that there are @media queries
.
They work with CSS.
But I need to do with JavaScript.
I need bxSlider to work only on% w / o%.
So, guys, I did the following and solved my problem:
jQuery(document).ready(function() {
if( $(window).width() <= 960){
jQuery('.img-parceiros').bxSlider({
nextSelector: '.seta-dir',
prevSelector: '.seta-esq',
nextText: '',
prevText: '',
auto: false,
slideWidth: 200,
minSlides: 2,
maxSlides: 2,
pager:false
});
}
});
One way you can do this is by using window.matchMedia .
For example:
if (window.matchMedia('screen and (max-width: 960px)').matches){
document.write('<script src="../js/bxSlider.js"></script>');
}
Remembering that I did not test, but in theory it should work.
Take a look at this link that should work for other browsers.