简体   繁体   English

jQuery插件与转换冲突:translateY

[英]jquery plugin conflict with transform: translateY

Im using a lightweight jQuery plugin call leanModal 我正在使用轻量级jQuery插件leanModal

The code for the plugin is included in this jsfiddle: https://jsfiddle.net/meqtu354/2/ 该插件的代码包含在此jsfiddle中: https ://jsfiddle.net/meqtu354/2/

All the plugin does is, for example in the jsfiddle, when u click on click to show popup , the pop up show up and the rest of document get covered by a huge dark transparent div. 例如,在jsfiddle中,所有插件所做的就是,当您单击click to show popup ,弹出的窗口就会显示出来,而其余文档将被一个巨大的深色透明div覆盖。

But for some reason when I add: transform: translateY to my css 但是由于某些原因,当我添加: transform: translateY到我的CSS

https://jsfiddle.net/meqtu354/3/ (check the css, added two selectors) https://jsfiddle.net/meqtu354/3/ (检查CSS,添加了两个选择器)

now when you click click to show popup , the overlay (dark transparent div) cover the popup too. 现在,当您单击click to show popup ,覆盖层(深色透明div)也将覆盖弹出窗口。

I been reading this for half an hour now, but still cant figure out why 我现在已经阅读了半个小时,但仍然不知道为什么

You need to put the popup div outside of the st-scroll class: 您需要将弹出div放在st-scroll类之外:

<div id="popup">POPUP</div>

<div class="st-scroll">

    <section></section>
    <script></script>
    <section></section>

</div>

I tried it in your fiddle and it worked. 我在您的小提琴中尝试了一下,效果很好。 When you apply a 3d transform property, I think it merges the div as if it is one object without layers. 当您应用3d变换属性时,我认为它会合并div,就好像它是一个没有图层的对象一样。

you are using adjacent selectors, but not selecting the <a href=""> you have between #st-control-1 and .st-scroll. 您正在使用相邻的选择器,但没有选择#st-control-1和.st-scroll之间的<a href=""> that some how is breaking the flow of the CSS. 一些如何打破CSS的流程。 The correct adjacent selector path is: 正确的相邻选择器路径是:

#st-control-1:checked ~ #st-panel-1 .st-scroll { transform: translateY(0%); -ms-transform: translate(0%); -webkit-transform: translate(0%); }

Also, use the vendor pre-fix in your css for these type of properties. 另外,对于这些类型的属性,请在CSS中使用供应商前缀。 hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM