如何在固定位置的页面顶部显示div? [英] How to show a div on top of the page in fixed position?

查看:240
本文介绍了如何在固定位置的页面顶部显示div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将载入内容 图片保留在某个位置时出现问题:修复。



我的容器通过点击按钮加载隐藏的内容,加载的内容应该从右向左滑动。它应该总是在顶部。



载入的内容< div class =sticky> cat image< / div> 固定在顶部。
任何帮助将非常感激。

 < html> 
< div class =container>许多照片< / div>
< button> LOADED-CONTENT来自transform(translateX(0%)< / button>
< / html>

< html>

< button>后退按钮可滑动加载的内容转换(translateX(100%)< / button>
< / html>

http://jsfiddle.net/ 6kpnN /

解决方案

您可以使用css

  #IdName {
position:fixed;
top:0px;
}
/ pre>

JSFIDDLE



您可以在此这里了解


I'm having some issues to keep my Loaded-Content image on a position:fixed.

My Container loads an hidden content by clicking the button, with a transition the loaded content should slide from the right to Left. Its should be always on the top.

The loaded-content <div class="sticky">cat image</div> should always be fixed on the top. Any help would be much appreciated.

<html>
<div class="container">many photos</div>
<button>LOADED-CONTENT comes in transform(translateX(0%)</button>
</html>

<html>
sticky image always on top.
<button>back button slides the loaded content transform(translateX(100%)</button>
</html>

http://jsfiddle.net/6kpnN/

解决方案

you could do it with css

#IdName{
position: fixed;
top: 0px;
}

JSFIDDLE

you can learn css here

这篇关于如何在固定位置的页面顶部显示div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆