Javascript Image Slider / Posts /

Center image in sliderframe

0

How can I center an image inside the sliderframe?

Johan  7 years ago   viewed: 2828    

7 Answers

0

Nobody knows this? I have tested allthe stuff I can think of but it won't work.

Johan
  7 years ago
0

I didn't try. But I think CSS can help. The image you see is actually the DIV's background image, so you can use the background-position to center the image. Maybe you also need to use !important declaration to overwrite its default style settings. For example: background-position:center center!important.

You can also consider Ninja Slider that has more flexibility for developers.

Peter   7 years ago
0

Is it here? Or where is it. I have tride on othere places but it won't work.

#slider img { ...... background-position:center center!important; ....... }
Johan
  7 years ago
0

No. If you know how to use Chrome developer tool, you can view the slider's markup in the Elements panel of the Chrome developer tool, and you will find the following element:

<div id="slider"> <img ... /> <img ... /> <img ... /> <div class="sliderInner"> <div class="mcSlc" style="background: url("/slider/jsImgSlider/images/image-slider-4.jpg") 0px 0% no-repeat;"></div> </div> </div>

So you can try adding the style to override the javascript generated style (0px 0% no-repeat):

#slider div.mcSlc {background-position:center center!important;}
Milo   7 years ago
0

Hi Peter.

Thank you so mutch for the help.

It did work. But it starts at the left then when the image change to another it "jumps" to center. Do you know a workaround for that so it starts always at the center?

Johan
  7 years ago
0

Please go to http://www.menucool.com/javascript-image-slider#view2, and you will find this instruction:

Make the slider the same size as your images. For example:#slider { width:960px;height:420px; }

If you are using Javascript Image Slider you have to keep the slider the same size as your images.

If you prefer responsive slider that can change its sizes according to the window size, you are recommended to use the Ninja Slider.

Milo   7 years ago
0

Thanks Peter for the advise.

Johan   7 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: