Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


  <h1>Intersection Observer Demo</h1>
    <p>Biscuit jelly-o lollipop jelly sesame snaps fruitcake. Gummies cotton candy pie pudding danish sweet roll pastry. Candy canes lollipop oat cake sugar plum fruitcake cheesecake halvah soufflé. Oat cake bonbon toffee muffin brownie gummi bears tiramisu gummi bears. Pie candy canes lemon drops cake candy donut jujubes. Muffin wafer fruitcake. Jelly cupcake macaroon candy canes brownie cookie chocolate. Powder biscuit apple pie.</p>
    <p>Cotton candy macaroon pudding biscuit. Pudding cotton candy candy cheesecake pie danish. Muffin marzipan cake jelly-o candy canes sweet roll bear claw chocolate croissant. Dragée liquorice sweet roll soufflé sweet roll gummies toffee wafer lollipop. Cotton candy brownie dragée caramels. Chupa chups cheesecake pie oat cake. Caramels chupa chups icing cupcake cupcake toffee donut. Ice cream tiramisu gingerbread wafer croissant pudding lemon drops ice cream soufflé.</p>
    <p>Candy lollipop chocolate bar donut lollipop. Sweet roll halvah tart brownie ice cream oat cake caramels ice cream. Dessert cotton candy pastry bear claw cheesecake brownie gummies dessert. Cookie apple pie apple pie halvah brownie jelly beans biscuit candy canes. Oat cake cookie cookie chocolate bar fruitcake bonbon toffee jelly beans chupa chups. Danish marshmallow halvah pudding cake chupa chups. Jelly lollipop tootsie roll pastry lemon drops carrot cake. Cookie dragée bear claw lemon drops oat cake. Jelly-o powder jelly-o jelly beans.</p>
    <p>Bear claw cake pie cheesecake toffee toffee jelly beans oat cake cake. Icing donut macaroon. Gummi bears apple pie chocolate bar sweet soufflé biscuit. Chocolate bar jelly marzipan fruitcake toffee bonbon soufflé. Powder pudding macaroon carrot cake powder cake. Powder jelly-o tart liquorice. Muffin tart fruitcake. Gummi bears halvah lemon drops wafer sweet roll marshmallow chocolate bar. Chocolate bar fruitcake biscuit cake cake bonbon. Pie cupcake sweet roll wafer donut.</p>
    <p>Chupa chups macaroon dessert sweet roll pudding lemon drops candy canes. Icing brownie bear claw. Muffin bonbon sweet pudding dragée caramels sesame snaps sesame snaps. Cake pudding icing tart halvah pudding topping cheesecake muffin. Pastry lemon drops topping sweet roll cake cupcake. Croissant danish brownie jelly beans icing brownie. Soufflé dragée marzipan brownie. Cotton candy chupa chups jujubes caramels cake pudding gummi bears.</p>
    <p>Brownie pudding muffin tootsie roll cupcake chocolate sesame snaps danish muffin. Cheesecake jelly beans marshmallow gingerbread wafer fruitcake donut muffin. Caramels tart apple pie topping tootsie roll. Sugar plum topping sugar plum dessert gummies halvah apple pie wafer soufflé. Jelly-o sugar plum bear claw. Candy canes liquorice powder chocolate bar macaroon carrot cake apple pie brownie danish.</p>
    <p>Tootsie roll dessert icing pastry cookie bear claw. Biscuit pudding wafer. Sweet marzipan cake muffin cake sesame snaps candy canes. Ice cream jelly beans cotton candy brownie candy sweet. Ice cream candy canes powder bear claw marzipan lollipop bear claw. Carrot cake sesame snaps pudding soufflé fruitcake muffin tart bonbon marshmallow. Wafer cake gingerbread liquorice. Marshmallow sesame snaps apple pie ice cream jujubes marshmallow donut dessert. Cupcake jelly-o muffin tiramisu lemon drops gummies liquorice halvah. Dragée apple pie donut cake tart apple pie pastry lemon drops.</p>
    <p>Jujubes jelly beans halvah jelly-o gummi bears lemon drops dragée jelly-o gingerbread. Lollipop cotton candy caramels chupa chups soufflé. Jelly beans carrot cake bonbon gingerbread tootsie roll donut candy lollipop chocolate bar. Halvah chocolate cake sweet roll halvah fruitcake marzipan. Candy jujubes halvah. Dessert biscuit cake marzipan cupcake muffin. Chocolate cake lollipop tart gummies. Apple pie cheesecake ice cream fruitcake sweet cotton candy lemon drops cake chocolate. Jujubes powder sugar plum brownie gingerbread. Toffee gummies macaroon jelly beans bonbon pie lollipop topping apple pie.</p>
    <p>Chocolate bar sesame snaps chocolate bar halvah. Tootsie roll apple pie jelly beans biscuit. Donut chocolate marshmallow. Lemon drops donut liquorice candy. Caramels wafer cake. Lemon drops pie soufflé jelly-o. Toffee sugar plum chocolate bar carrot cake.</p>
    <p>Candy canes chupa chups jelly-o sesame snaps cupcake macaroon dessert marzipan. Cookie jujubes marzipan tiramisu gingerbread muffin. Bear claw sweet bonbon cotton candy. Muffin liquorice jelly icing marzipan. Gummies sugar plum candy canes brownie muffin marshmallow marzipan. Jelly-o topping cake bear claw. Gummi bears ice cream pie gummi bears candy canes.</p>
    <p>Muffin chocolate tootsie roll. Gummies cake jelly gummi bears cupcake. Sugar plum pie jelly beans caramels pastry jelly jujubes chocolate bar danish. Lollipop chocolate chocolate sugar plum jelly dragée cake. Icing pudding cotton candy apple pie carrot cake. Dragée cotton candy pudding donut topping. Jelly beans marzipan tart cheesecake lollipop brownie macaroon cotton candy. Topping tiramisu pastry cupcake dessert apple pie. Cookie tiramisu carrot cake donut. Cake marzipan jelly sugar plum muffin sweet dessert.</p>
    <p>Powder marshmallow brownie liquorice cheesecake topping candy topping muffin. Dragée gingerbread chocolate bar ice cream soufflé chocolate danish dessert topping. Sesame snaps dessert pie tiramisu carrot cake. Wafer apple pie tiramisu muffin. Sugar plum gingerbread pudding toffee dessert danish dragée. Brownie marshmallow cotton candy marshmallow tart pie carrot cake halvah.</p>
    <p>Carrot cake cake jelly-o sugar plum powder macaroon marshmallow. Chocolate jelly chupa chups. Cupcake candy carrot cake chocolate cake carrot cake icing pie. Topping pudding gummi bears cookie jelly-o tiramisu chupa chups chocolate candy canes. Halvah liquorice tootsie roll pudding lemon drops lemon drops jujubes carrot cake jujubes. Lollipop gummi bears caramels cheesecake marshmallow candy cupcake icing.</p>
    <p>Cake ice cream chupa chups. Apple pie cotton candy pudding cake chupa chups pastry marzipan cookie marzipan. Dessert chupa chups topping. Wafer lemon drops sesame snaps gummies oat cake tiramisu tart apple pie sesame snaps. Tiramisu soufflé tootsie roll cookie pudding carrot cake. Lollipop icing macaroon liquorice marzipan bonbon ice cream tiramisu gingerbread. Lollipop sweet tiramisu dragée. Liquorice jelly-o candy canes.</p>
    <p>Dessert lemon drops cheesecake danish. Chupa chups apple pie icing jelly beans sweet lemon drops carrot cake liquorice muffin. Donut gingerbread carrot cake dessert brownie icing chocolate bar. Soufflé sweet roll apple pie liquorice. Caramels tootsie roll lemon drops cake. Bear claw sugar plum pastry danish sesame snaps gummies macaroon lollipop gummies.</p>
    <p>Apple pie jelly-o jelly beans cheesecake muffin croissant sugar plum jelly-o. Jelly marzipan cheesecake marzipan cupcake fruitcake marshmallow. Tootsie roll fruitcake marshmallow jelly beans ice cream carrot cake caramels soufflé. Gummies jelly beans cupcake. Caramels chocolate sesame snaps. Chocolate pie carrot cake dragée pudding cake marshmallow croissant tootsie roll. Candy sugar plum tiramisu dessert halvah sugar plum muffin halvah. Lemon drops candy wafer chocolate sesame snaps pastry. Cupcake gingerbread bonbon dragée.</p>
    <p>Tart danish jelly caramels lollipop. Cake halvah marshmallow dessert tootsie roll. Marshmallow icing sweet sesame snaps cheesecake. Halvah cookie donut chocolate bar bear claw gummi bears croissant. Lemon drops halvah cheesecake. Chocolate ice cream cake icing dragée. Fruitcake gingerbread chocolate bar toffee cotton candy cake. Liquorice chocolate cake sesame snaps.</p>
    <p>Powder lollipop toffee gummies tiramisu jelly tiramisu cupcake candy canes. Bear claw sweet fruitcake oat cake wafer tootsie roll dragée marshmallow. Muffin croissant wafer. Lollipop danish dragée tiramisu sugar plum topping cheesecake carrot cake pudding. Bonbon topping pie. Bonbon jujubes lollipop candy bonbon halvah gummies jelly jelly beans.</p>
    <p>Sweet roll cotton candy muffin. Pastry pie jelly jelly chocolate cake marzipan topping jelly-o. Toffee biscuit candy canes powder tiramisu jelly beans. Lollipop cotton candy cake oat cake sugar plum powder. Marshmallow muffin tiramisu. Oat cake cookie tootsie roll pudding tart. Jelly beans pie liquorice donut.</p>
    <p>Chocolate cake bonbon gummies jelly-o chocolate wafer cupcake gummies. Gummi bears chocolate macaroon bear claw oat cake. Halvah croissant tootsie roll. Chocolate tootsie roll jelly beans carrot cake fruitcake icing tootsie roll. Cheesecake pie caramels sesame snaps cheesecake. Marshmallow apple pie cake powder gummies jelly cake. Halvah sesame snaps chocolate bar sweet roll soufflé halvah. Candy chupa chups ice cream chocolate powder lemon drops marshmallow jelly. Cotton candy jujubes tootsie roll wafer. Carrot cake cookie cookie pastry halvah jelly beans sweet gummies.</p>

<span id="alert"></span>


                body {
  background-color: #f9f9f9;
  margin: 0;

main {
  max-width: 80ch;
  margin: 0 auto;

article {
  position: relative;
  padding: 2rem;
  background-color: #fff;

#halfway {
  position: absolute;
  top: 50%;
  width: 1px;
  height: 1px;
  /* ensures it won't block any part of article elements */
  pointer-events: none;

#alert {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  padding: 0.25em;
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;

  &.visible {
    background-color: rgba(yellow, 0.95);

article > :last-child {
  color: red;
  display: grid;
  grid-gap: 0.25rem;

  &::after {
    content: "";
    border-top: 1px dashed currentColor;



                if ("IntersectionObserver" in window) {
  const alert = document.getElementById("alert");

  const endpointObserver = new IntersectionObserver(
    (entries) => {
      const endpoint = entries[0];
      if (!endpoint.isIntersecting) return;


      // Here is where you would add your tracking code
      alert.innerText = "Viewed";
      threshold: 0.1,
      root: null

  endpointObserver.observe(document.querySelector("article > :last-child"));