防止固定元素在具有相对定位元素的页面上消失

时间:2016-03-02 23:34:44

标签: css css-position

我必须完全误解position: fixed;

我希望页面底部的固定元素始终占据屏幕的底部。它在Chrome 48.0.2564.116 Mac 10.9.5上按预期工作,即使调整窗口大小使window.document.body.clientWidth小于相对元素的左侧位置,即400px,小于510px。但是,如果相对定位元素的左侧值大于屏幕宽度(或者宽度不是这样)设置为0px(?!))。

.justifiedBottom

客户端宽度为360,左侧位置为.positionedRelative为322px,会产生以下内容(请注意,固定元素被推离屏幕底部):

fixed element is being pushed off the bottom of the screen

任何有关正确方向的想法或指示都会非常感激。感谢。

2 个答案:

答案 0 :(得分:0)

从它的外观来看,它与你的宽度有关。看看:https://jsfiddle.net/0Lqnfmad/3/

Exception while invoking method 'resetPassword' Error: setUserId must be called on string or null, not object 
    at [object Object]._.extend._setUserId (livedata_server.js:774:13) 
    at [object Object].setUserId [as _setUserId] (livedata_server.js:666:14) 
    at [object Object]._.extend.setUserId (packages/ddp-common/method_invocation.js:94:1) 
    at AccountsServer.Ap._loginUser (accounts_server.js:286:20) 
    at AccountsServer.Ap._attemptLogin (accounts_server.js:340:12) 
    at AccountsServer.Ap._loginMethod (accounts_server.js:368:15) 
    at [object Object].Meteor.methods.resetPassword (password_server.js:643:19) 
    at maybeAuditArgumentChecks (livedata_server.js:1698:12) 
    at livedata_server.js:708:19 
    at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1) 

看看这对你有帮助!

答案 1 :(得分:0)

**编辑**此不起作用。如果您将 void MyClass::myFunction() { ComboBoxItemDelegate* myDelegate; myDelegate = new ComboBoxItemDelegate(); model = new STableModel(1, 8, this); filterSelector->tableView->setModel(model); filterSelector->tableView->setItemDelegate(myDelegate); connect(filterSelector->tableView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(slotHandleDeleteButton(const QModelIndex&))); exec(); } void MyClass::slotHandleDeleteButton(const QModelIndex& index) { if(index.column() == 8) model->removeRow(index.row()); } 左值更改为更大的值,例如420固定元素再次消失(?!!!)。

我仍然不明白.positionedRelativeposition: relative;如何以及为何相互干扰,但 解决方案似乎是将相对组件包装成绝对的定位组件:

position: fixed;