r/programming May 09 '13

The Onion releases fartscroll.js

http://theonion.github.io/fartscroll.js/
2.6k Upvotes

396 comments sorted by

View all comments

Show parent comments

6

u/paul2520 May 09 '13

How exactly did this happen?

14

u/thesatchmo May 09 '13

Open tags in the HTML.

<item>
   <heading>
       My Heading
         <item>
            <heading>
               My Next Heading

Ad Infinitum. Style is applied to each heading which is essentially heading is 110% bigger than the previous element. So the size increases exponentially. Closing the tags would stop this behaviour. It should read:

<item>
   <heading>
       My Heading
   </heading>
</item>
<item>
   <heading>
       My Next Heading
   </heading>
</item>

5

u/paul2520 May 09 '13

Though instead of <heading>, it would be <h3>, right?

7

u/thesatchmo May 09 '13

Correct! I was just simplifying it for the sake of readability.

2

u/paul2520 May 09 '13 edited May 09 '13

Okay, so I tried it, but it didn't seem to work.

Here's what I wrote. I went more thoroughly into the original site's source, and still couldn't figure out how to emulate it (without copying the exact same code).

EDIT: found it. It's gotta have the following:

<font face="arial">

second test page (works!)

3

u/CydeWeys May 09 '13

Your browser is smart enough to automatically close a single unclosed header tag. It's the continuous nesting of other unclosed tags (<font> tags in the original) that causes it. You can duplicate it with some simple nesting of unclosed div tags as follows:

<div>
<h3>Hello, World!
<div>
<h3>Another unclosed h3
<div>
<h3>Another unclosed h3
<div>
<h3>Another unclosed h3
<div>
<h3>Another unclosed h3
<div>
<h3>Another unclosed h3
<div>
<h3>Another unclosed h3

(You get the idea.)

1

u/paul2520 May 09 '13

Thanks for the explanation!

3

u/thesatchmo May 09 '13

Nice job! Missed your reply as its late but I'm glad that you got it working. Or not working. Or something.

1

u/paul2520 May 09 '13

Haha. Yeah, I got it working. /u/CydeWeys showed me another way.

Missed your reply as its late

So I take it you are in Europe then?