javascript - Width of div changes when position becomes fixed from relative - Stack Overflow

The width of the div "topNav" changes by few pixels when its position style is changed from r

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
Add a ment  | 

2 Answers 2

Reset to default 5

You 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;

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745465793a4628914.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信