绝对定位不适用于Javascript DIV
Absolute positioning not working on Javascript DIV
我使用了一些Javascript,它可以从网页底部向上滑动div,并试图将其定位为绝对的底部中心。
底部的DIV似乎在左下角,无论浏览器窗口大小如何,我都试图将其居中
我想看看这个URL,看看有问题的页面:http://s361608839.websitehome.co.uk/oneonly/index.html
HTML:
<div class="slide-out-div">
<a class="handle" href="http://link-for-non-js-users">Content</a>
<a href="mailto:name@domain.com">name@domain.com</a><br /><br />
<p>Address</p>
<p>Telephone</p>
</div>
CSS:
.slide-out-div {
padding: 20px;
width: 276px;
background: url(images/kontakt-bg.png);
color: #fff;
}
JS:
$(function(){
$('.slide-out-div').tabSlideOut({
tabHandle: '.handle', //class of the element that will be your tab
pathToTabImage: 'images/kontakt-tab.png', //path to the image for the tab (optionaly can be set using css)
imageHeight: '26px', //height of tab image
imageWidth: '316px', //width of tab image
tabLocation: 'bottom', //side of screen where tab lives, top, right, bottom, or left
speed: 300, //speed of animation
action: 'click', //options: 'click' or 'hover', action to trigger animation
fixedPosition: false //options: true makes it stick(fixed position) on scroll
});
});
谢谢!
添加
left: 50%;
margin-left: -138px; /* half its width which you have set to be 276px */
到.slide-out-div
(在通过开发人员工具进行实时编辑时对我有效)。
您必须在.slide-out-div
中添加一个左侧位置
<div class="slide-out-div"
style="line-height: 1; position: fixed; bottom: -124px; width: 300px; left: 50%; margin-left: -150px; ">
其中负边距是宽度的一半。
将其添加到您的.s滑出div类中
margin-left: -138px; /* half of the width of the div */
left: 50%;
相关文章:
- 绝对定位不适用于Javascript DIV
- Javascript Div's宽度根据屏幕宽度
- Javascript DIV Display 在 Safari 中不起作用
- 在 LI 中插入 JavaScript DIV
- JavaScript - DIV的可见文本
- Javascript:DIV AppendChild
- CSS or JavaScript Div Blur magic
- CSS or Javascript DIV align
- Javascript - Div/Image 从顶部向下滑动
- Javascript Div元素问题
- Javascript DIV滚动移动
- Javascript Div Population
- Javascript Div Tallest
- (Javascript) Div toggle and cookies
- Javascript Div交换点击
- Php Javascript Div Refresh
- Javascript: Div onclick对某些Div内容不起作用
- Javascript:Div正在打开,但没有向后折叠
- 谷歌浏览器 - Javascript DIV 背景问题
- Javascript Div循环中的日期没有正确更新