固定位置div仅垂直 [英] Fixed Position div Vertical Only

查看:166
本文介绍了固定位置div仅垂直的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个当前的web构建,右侧边栏是固定位置。我已经尝试从正确的位置,但不希望它重叠其他div的内容。

I have a current web build with a right sidebar that is a fixed position. I have tried to positioning from the right but don't want it overlapping other divs content.

我正在寻找的是让内容可以水平向右滚动它是在视口窗口之外。任何帮助将非常感激。

What I am looking for is to have the content scrollable horizontally to the right when it is out of the viewport window. Any help would be greatly appreciated.

与此类似: http://demo.rickyh.co.uk/css-position-x-and-position-y/ 但是我不能让这个工作。

similarly to this: http://demo.rickyh.co.uk/css-position-x-and-position-y/ however I can not get this working.

这已通过替代方法解决。感谢那些真正考虑过帮助的人。

This has been solved by alternative method. Thanks for those who actually considered helping.

推荐答案

保留固定的div。

并有以下JavaScript代码,它将照顾水平移动。

And have the following javascript code which will take care of horizontal moving.

$(window).scroll(function(){
  $('.fixed_div').css('left',-$(window).scrollLeft());
});

这篇关于固定位置div仅垂直的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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