Can you stop jquery cycle from overwriting inline absolute position?

纵然是瞬间 提交于 2019-12-11 06:05:15

问题


Cycle overwrites the position for the images in the div with top:0 left:0 is there a way to stop that so I can use inline positioning?


回答1:


No.. You can cycle some divs and inside those divs you can use whatever inline styles you need on the images. Jquery Cycle uses its own positioning of the cycled elements to make the slideshow. Here is an example:

<div id="slideshow">
  <div><img src="pic.png" style="margin-left:10px" /></div>
  <div><img src="pic2.png" style="margin-left:10px" /></div>
  <div><img src="pic3.png" style="margin-left:10px" /></div>
  <div><img src="pic4.png" style="margin-left:10px" /></div>
  <div><img src="pic5.png" style="margin-left:10px" /></div>
</div>

$('#slideshow').cycle();



回答2:


You can write some custom css rules for each inline style, and append !important to each value, which will override the inline rules.



来源:https://stackoverflow.com/questions/10338413/can-you-stop-jquery-cycle-from-overwriting-inline-absolute-position

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!