作者:PHP_sunshine | 来源:互联网 | 2022-12-13 18:36
IamusingbxSliderforasimpleslider.WhendisplayedonthebrowserthebxSliderworksperfectly
I am using bxSlider for a simple slider. When displayed on the browser the bxSlider works perfectly but when debugging in phonegap the slider displays a white background with the slider navigational arrows.
我使用bxSlider作为一个简单的滑块。当在浏览器上显示时,bxSlider可以正常工作,但在phonegap中调试时,滑块会显示带有滑块导航箭头的白色背景。
Please help....
1 个解决方案
1
I had the same problem with Cordova and JqueryMobile. In iOS bxSlider worked like a charm, but in android I was getting the same, blank screen with the arrows like you.
我和Cordova和JqueryMobile有同样的问题。在iOS中,bxSlider像魅力一样工作,但在android中,我得到了与你一样的箭头一样的空白屏幕。
I think it is related to the $(document).ready() function. In some way, in Android the DOM is not well organized, so bxSlider can't make his work and hides all your images.
我认为它与$(document).ready()函数有关。在某些方面,在Android中DOM没有很好的组织,因此bxSlider无法完成他的工作并隐藏所有图像。
If this is your case, you can solve calling the bxSlider init function in other event of jquerymobile, after document ready one. Something like this should work:
如果是这种情况,您可以在文档就绪之后解决在jquerymobile的其他事件中调用bxSlider init函数。像这样的东西应该工作:
Slider page
/** Your images here **/
Remember to put in your css file a rule to hide the slider wrapper, like:
记得在你的css文件中加入一条规则来隐藏滑块包装器,如:
.slider_wrapper{
visibility: hidden;
}
This is because you are calling the init slider when page shows, so the final user should see your images unformatted and a brief moment after the slider working. You should not write display: none, because the slider wouldn't work either.
这是因为您在页面显示时调用init滑块,因此最终用户应该看到您的图像未格式化并且在滑块工作后的短暂时间。你不应该写display:none,因为滑块也不起作用。
Hope this make the trick for you.
希望这能成为你的伎俩。