2014-10-12 97 views
0

我正在切换标题的可见性,当我隐藏它时,我需要它是透明的并显示滚动内容。如何使标题透明并在隐藏时显示它

我尝试了几种方法,但标头不透明。请注意它被正确隐藏,但它留下了白色背景。所以我想让它透明:

$('.ui-header').hide().animate({opacity: 0.0});// Hide the header but its opacity doesn't get to 0 
$(".ui-header").css("backgroundColor", "transparent");// No effect 

如何使标题透明,以便显示下面的内容?

+0

如果你手动隐藏它,你需要调用'$ .mobile.resetActivePageHeight()'。页面顶部填充40px的标题。 – Omar 2014-10-12 15:04:28

+0

[set content height 100%jquery mobile]可能重复(http://stackoverflow.com/questions/21552308/set-content-height-100-jquery-mobile) – Malloc 2014-10-13 08:07:17

+0

你确定答案就是你要找的对于? – Omar 2014-10-13 08:09:30

回答

0
$(".ui-header").hide(); 

应该足够了。隐藏元素意味着不显示它,这相当于将元素的不透明度设置为零。

当阅读documentation for the jQuery function .hide()时,它清楚地表明没有任何参数的.hide()等效于CSS中的display: none;

如果你找不到JS的错误,我建议在ui-header的CSS中给display: none;。如果两者都不起作用,我们需要更多的代码来追踪错误并给出正确的答案。

编辑:一个JSFiddle演示可用here