admin管理员组文章数量:1430077
The width of the div "topNav" changes by few pixels when its position style is changed from relative to fixed. I found a jquery plugin (/) which can perform the same functionality I'm looking for elegantly, but I feel it is a overkill for this purpose.
EDIT: My question is how to avoid changing the div sizes.
Check out the code at :
The width of the div "topNav" changes by few pixels when its position style is changed from relative to fixed. I found a jquery plugin (http://imakewebthings.github./jquery-waypoints/) which can perform the same functionality I'm looking for elegantly, but I feel it is a overkill for this purpose.
EDIT: My question is how to avoid changing the div sizes.
Check out the code at :
http://jsbin./azace5/edit
Share Improve this question edited Jun 15, 2011 at 21:32 brayne asked Jun 15, 2011 at 21:11 braynebrayne 1,4032 gold badges17 silver badges28 bronze badges 1- What is the functionality you are looking to implement elegantly? – cmwright Commented Jun 15, 2011 at 21:15
2 Answers
Reset to default 5You need to remove the page's "default margin". This will do it in "every browser":
html, body {
margin: 0;
padding: 0
}
See: http://jsbin./azace5/2
Or you can add a minimum width.
min-width:600px;
本文标签: javascriptWidth of div changes when position becomes fixed from relativeStack Overflow
版权声明:本文标题:javascript - Width of div changes when position becomes fixed from relative - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745465793a2659530.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论