2

After getting the right answer from this question, I am having another problem - adding margin:0em auto; to my page will cause the page 'jumpy'

.align-center-public {
    width:1000px;
    margin:0em auto;
    overflow:hidden;
}

<div id="container">

    <div class="align-center-public">

        <p style="width:800px; text-align:center; border:1px solid #000;"><a href="#">Please scroll down until you see the click button</a></p>
        <p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
        <p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
        <p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>
        <div><a href="#" class="get-photo">click here</a></div>
        <p><img src="winnie-the-pooh-2011-9.jpg" alt="test"/></p>

    </div>

</div>

How can I fix this?

Here is the link again.

Community
  • 1
  • 1
Run
  • 54,938
  • 169
  • 450
  • 748

4 Answers4

2

EDIT

if ($.browser.msie && parseInt($.browser.version) < 9) 
    $('html').css('overflow', 'hidden');

$('body').css('overflow', 'hidden').css('padding-right','17px');

And:

if ($.browser.msie && parseInt($.browser.version) < 9) 
    $('html').css('overflow', 'auto');

$('body').css('overflow', 'auto').css('padding-right', 0);

And now I'm noticing that this apparently is all you need.

http://jfcoder.com/test/pooh.html

To keep the page from correcting when the scrollbars disappear, you need to pad the BODY appropriately. This is more than likely a different value for each browser. The above I have tested in FF6, IE8/9 and Chrome latest only.

Jared Farrish
  • 48,585
  • 17
  • 95
  • 104
1

Try a javascript pure... best 'body', not try use 'html' is bug.

<script>
document.body.style.overflow = 'hidden';
</script>
KingRider
  • 2,140
  • 25
  • 23
0

It is happening because you are changing the body overflow hidden to auto on clicing click here link. Is it required to be changed?

ShankarSangoli
  • 69,612
  • 13
  • 93
  • 124
  • yes I need to change `body`'s overflow to `hidden` otherwise I will have this problem - http://stackoverflow.com/questions/7299495/two-scrollbars-problems – Run Sep 04 '11 at 18:58
0

It seems, too, that the images are being redisplayed when the viewport shrinks horizontally, but only after the viewport width narrows to within some set width. That's why you are getting the flash. How about putting some more borders around the images so you can get an idea what that width is?

Also: you don't have to put the images in <p>s -- there might be some interaction between paragraph and image processing in the browser. You might want to remove the <p>s and see what happens.

Pete Wilson
  • 8,610
  • 6
  • 39
  • 51