jd says jd says - 2 years ago 111
Javascript Question

How to disable next/prev button when slider have only one image?

When slider have one image then don't want next/prev button but if slider have more than 1 images then required next/prev button. Can you please suggest me JavaScript code to do. I know how to disable next/prev through controls false

controls : false

but it is also false when image have more than one image.
Here is my code,

var imgCnt = $('#images').val(); //get images count.
if(imgCnt == 1){

Answer Source

I have tried this code and it's working fine. Please try to your program. Using ternary operator.

        controls: ($("ul.bxslider").length > 1) ? true: false,
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download