How do I interact with items in the background in ionic while a popover is active?

半世苍凉 提交于 2019-12-24 00:57:30

问题


Ionic Version: 1.x

Platform: all

I have an ionic app which uses an ionic popover. However, when the popover is active (open), I can no longer interact with things in the background, for example scroll down my list of items. I have tried looking for existing answers for this question, but did not see the question being asked.

The popover itself does not have to be bound to any active element on the page, since it currently has position:fixed and will always appear in the same position.

So basically the question is, is there a way to prevent the popover from preventing me interacting with everything in the background?


回答1:


I found this codepen someone put up:

https://codepen.io/ionic/pen/GpCst

This may do the trick?

.popover-backdrop {
  display:none;
}



回答2:


I have found an answer, however, not sure if there is a better way to do this, perhaps an option that turns interacting with the background on and off, but for now the answer seems to be as follows:

  1. Ensure the .popover-backdrop class is the same size and position (height and top margin in my case) as the actual fixed popover element. The default is height 100%.
  2. Ensure that for the .popover-open class (applied to the body) you disable pointer-events: none;
  3. Keep in mind that this will change the behaviour where if you click outside of the popover that it will close it by default. So in ionic, I will have to make sure that on the event where I leave the view that closes the popup if active.


来源:https://stackoverflow.com/questions/38371040/how-do-i-interact-with-items-in-the-background-in-ionic-while-a-popover-is-activ

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