Q: Jssor account for body padding in Scalewidth

74 views Asked by At

I am running into some responsive problem with the jssor slider. I get an overlap on the right side which also gives a horizontal scrollbar.

I think it's because of the scalewidth percentage, if i lower this percentage with 0.03 it looks good. I am using a body padding of 10px on the left and right, so that on mobile there is breathing room.

I think i need a new 'formula' to intergrate the padding's in the calculation of the scalewidth.

            if (bodyWidth)
                jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 619)); //set max width for the page or container

Sadly i am a complete programming noob so i am hoping that someone can help me fix this because i really like the slider but i need the images to be pushed 10px from both sides (by the body)

1

There are 1 answers

1
jssor On BEST ANSWER

As there is 10 + 10 = 20 padding in width,

if (bodyWidth)
    jssor_slider1.$ScaleWidth(Math.min(bodyWidth - 20, 619));