Proportions slider (jquery.slider.)

0

I have a problem performing a slider with jquery.slider.js The slider works for me correctly The problem is the proportion of the image. It has an established ratio and to adjust the size it only lets me change the width. In function of this, the displayed height is adapted and everything that stands out, cuts it. The height does not matter what value you put, because you ignore it. I have an image that is very "high" compared to the width, and for that reason the only way I have to see it all is to set the width very large, but then a horizontal scroll bar appears. If I set the width to 100% or approximately the size of the screen, the image is cut in half. Is there any way to adjust the width and height independently?

Thank you very much in advance.

The code is something like this:

Html ----------------

<section id="container">
         <div class="slides">
               <div id="slide1">
                    ……
               </div>
               <div id="slide2">
                    ……
               </div>
         </div>
</section>

CSS -----------------

#container{
      width:900px
     height:2300px;
}
    
asked by Rafa 28.12.2017 в 17:44
source

1 answer

0

The idea is very simple with CSS and HTML, in your case you already have the structure and you have given a width:900px to <section id="container"> this is your main container.

Look at the source code of the example with ctrl + uo inspect on an image: Example of slider.js .

Once you have the container with a fixed size set (As in your case) you only have to add to the <img ../> tags a dynamic size that adapts to the size of your container (the 900px).

Example:

<div id="slides">
  <div class="slidesjs-container" style="width: 900px; height: 2300px;">
    <div class="slidesjs-control">
      <img src="1.jpg" class="slidesjs-slide" slidesjs-index="0" style="width: 100%;">
      <img src="2.jpg" class="slidesjs-slide" slidesjs-index="1" style="width: 100%">
    </div>
  </div>
  <a href="#" class="slidesjs-previous slidesjs-navigation"> < </a>
  <a href="#" class="slidesjs-next slidesjs-navigation"> > </a>
</div>

I hope it helps you.

A greeting.

    
answered by 28.12.2017 в 18:35