最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Firefox textarea typing causing screen shaking (firefox2 winXP) - Stack Overflow

matteradmin6PV0评论

EDIT: Firefox 2 windows XP

Steps to reproduce problem:

Firefox 2 and visit: .html

Begin Typing and pressing [enter key] to create new lines

After about 10 [enter key] presses you'll notice the screen shaking

How this happened

This began happening after I installed a plugin for jQuery. It's located here: //js/textarea.js

It makes it so the textarea is expandable as I type, depending on how many lines there are in the text area, up to a max-height value which can be specified in CSS.

I tried disabling the 'setHeight' function within this plugin (the only thing that changes height dynamically) but I still saw the screen shaking.

When I think the problem might be

Firefox thinks that the screen just got larger, and pensates by putting in a scrollbar on the right side of the body document.

However, it realizes that in fact the page didn't get larger, and removes the scrollbar, causing the shaking.

I have no idea where in the code that makes Firefox think this way...

Appreciate any help.

EDIT: Firefox 2 windows XP

Steps to reproduce problem:

Firefox 2 and visit: http://resopollution./rentfox/html/property_setup.html

Begin Typing and pressing [enter key] to create new lines

After about 10 [enter key] presses you'll notice the screen shaking

How this happened

This began happening after I installed a plugin for jQuery. It's located here: http://resopollution./rentfox/html//js/textarea.js

It makes it so the textarea is expandable as I type, depending on how many lines there are in the text area, up to a max-height value which can be specified in CSS.

I tried disabling the 'setHeight' function within this plugin (the only thing that changes height dynamically) but I still saw the screen shaking.

When I think the problem might be

Firefox thinks that the screen just got larger, and pensates by putting in a scrollbar on the right side of the body document.

However, it realizes that in fact the page didn't get larger, and removes the scrollbar, causing the shaking.

I have no idea where in the code that makes Firefox think this way...

Appreciate any help.

Share Improve this question edited Jul 7, 2009 at 19:22 resopollution asked Jul 7, 2009 at 19:02 resopollutionresopollution 20.4k10 gold badges43 silver badges49 bronze badges 3
  • 4 make sure the legs on your table are level. And stop typing so hard. ;) – Jimmy Commented Jul 7, 2009 at 19:15
  • Interestingly, only the portion from 101 to 115 shakes on my screen. From 116 on doesn't shake. – Scott Baker Commented Jul 7, 2009 at 19:19
  • I am using FF 3.0.9, on XP SP3 – Scott Baker Commented Jul 7, 2009 at 19:20
Add a ment  | 

5 Answers 5

Reset to default 3

You can either force a scrollbar: http://css-tricks./eliminate-jumps-in-horizontal-centering-by-forcing-a-scroll-bar/

or hide the overflow of the div and try to get rid of the scrollbar, try overflow: hidden instead of auto in the div propertySetup

Can't reproduce, works fine here in Mac OSX + Firefox 3.5.

I can reproduce it (Debian Lenny, IceWeasel 3.0.6), but only with a very, very specific window size for FireFox (just slightly taller than 1024px, depending on your system font size, window manager and number of toolbars shown).

Just make your page slightly shorter or taller and the problem goes away. The problem only occurs when the addition of a new line after the 10th or so causes firefox to grown the page just enough to cause the scrollbar to appear. Just as you guessed.

That's a tiny 10px margin that is dependent on a lot of browser and system specific settings. In your page that margin is somewhere around the 1024px limit, depending on system font, toolbars, window decorations and the phase of the moon. Move that margin out of the 1024px region. Either make the page 40-50px shorter so that the scrollbar does not appear (even with large system fonts and an extra toolbar) or make it taller so the scrollbar is always there. Zoltan Lengyel's answer in this thread to always force the scrollbar can also be used.

I can reproduce it in Firefox 3.0.11 in Win XP.

Adding overflow:hidden to the body tag seemed to fix the problem, but doing that may wind up causing you more grief then disabling the plugin altogether. Giving the body tag overflow-x:scroll will stick a scrollbar there permanently but seems to solve it, too.

I reproduced it on Windows, FF3.

Interestingly it seems to happen within the jQuery .height() function! Unfortunately you're using the minified version, so that's as far as I can get.

Post a comment

comment list (0)

  1. No comments so far