123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!--you don't need the "data-step" attr, but can be useful for storing instructions for JS -->
<section class="intro">
    <h1>Team Warbler</h1>
    <h2>Canary in the coal mine</h2>
    <p>Here is some intro text</p>
    <ul class="li">Some Text</ul>
    <ul class="li">Some Text</ul>
    <ul class="li">Some Text</ul>
    <ul class="li">Some Text</ul>
    <ul class="li">Some Text</ul>
    <ul class="li">Some Text</ul>
</section>
<section id="scroll">
<div class="scroll__graphic sticky" style="width: 100%; height: 349px;">
    <div class="overlay">
    <div class="chart" id="map" style="width: 100%; height: 1000px;">
        <p>1</p>
    </div>
    </div>
</div>
<div class="scroll__text">
    <div class='step' data-step='1'>
        <h3>Birds Start Here</h3>
        <p>
            Here is some text about how and where birds fly. Test upload.
        </p>
        <img src="https://rampages.us/extras/warbler/imgs/Cathy%20-%20Photo%20by%20gwen%20pearson.jpg" alt="">
    </div>
    <div class='step' data-step='2'>
            <h3>Birds Then Fly Here</h3>
            <p>
                Here is some text about how and where birds fly.
            </p>
        <img src="https://rampages.us/extras/warbler/imgs/San%20Lorenzo%20Red%20mangroves%20copy.jpg" alt="">
    </div>
    <div class='step' data-step='3'>
            <h3>Birds Stop Here</h3>
            <p>
                Here is some text about how and where birds fly.
            </p>
            <img src="https://rampages.us/extras/warbler/imgs/banding%20station%20copy.jpg" alt="">

    </div>
    <div class='step' data-step='4'>
            <h3>Then Maybe One More Place</h3>
            <p>
                Here is some text about how and where birds fly. One more change.
            </p>
            <img src="https://rampages.us/extras/warbler/imgs/PV%20copy.jpg" alt="">

    </div>
</div>
</section>
<section>
    <p>Here is some text</p>
    <p>Here is some text</p>
    <p>Here is some text</p>
</section>
            
          
!
            
                   body {
            font-size: 16px;
            font-family: Arial, Helvetica, sans-serif;
        }
        .intro {
            min-height: 500px;
        }
        #scroll {
            position: relative;
        }
        .step {
            min-height: 500px;
            padding: .5rem;
        }

        .step img {
            width: 100%;
            height: auto;
        }

        .scroll__graphic {
            position: -webkit-sticky;
            position: sticky;
            float: right;
            top: 0;
            right: 0;
            -webkit-transform: translate3d(0, 0, 0);
            -moz-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
        }

        .scroll__text {
            position: relative;
            padding: 0 1rem;
            max-width: 30rem;
            width: 33%;
        }

        .overlay {
            background: rgba(255,255,255, .75);
        }

        #map {
            z-index: -5;
        }
            
          
!
            
               var mymap = L.map('map', {zoomControl: false}).setView([37.646152, -77.511429], 6);
        L.tileLayer('https://api.mapbox.com/styles/v1/jeffeverhart383/cjgo34i5100202srogwdfs2mn/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoiamVmZmV2ZXJoYXJ0MzgzIiwiYSI6IjIwNzVlOTA3ODI2MTY0MjM3OTgxMTJlODgzNjg5MzM4In0.QA1GsfWZccIB8u0FbhJmRg', {
            attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
            maxZoom: 18,
            id: 'mapbox.streets',
            accessToken: 'pk.eyJ1IjoiamVmZmV2ZXJoYXJ0MzgzIiwiYSI6ImNqOXI2aDg5ejZhYncyd3M0bHd6cWYxc2oifQ.fzcb7maGkQhAxRZTotB4tg'
        }).addTo(mymap);


        var warblerWaypoints = [
            {title: "Richmond",
                id: 1,
             location:  {
                 lat: 37.646152,
                 lng: -77.511429
             }
            },
            {title: "Alabama",
            id: 2,
             location:  {
                 lat: 34.738228,
                 lng: -86.601791
             }
            },
            {title: "Mexico",
            id: 3,
             location:  {
                 lat: 19.432608,
                 lng: -99.133209
             }
            },
            {title: "Panama",
            id: 4,
             location:  {
                 lat: 8.983333,
                 lng: -79.516670
             }
            },
        ]
        mymap.scrollWheelZoom.disable()

        warblerWaypoints.forEach(waypoint => {
            //let marker = L.marker([waypoint.location.lat, waypoint.location.lng ]).addTo(mymap)
        })

        let latlngs = warblerWaypoints.map(waypoint => [waypoint.location.lat, waypoint.location.lng]);
        var polyline = L.polyline(latlngs, {smoothFactor: 10, color: 'orange', weight: 120, opacity: .5}).addTo(mymap);
        var polyline = L.polyline(latlngs, {color: 'red', dashArray: '12 12',}).addTo(mymap);
        // instantiate the scrollama
        const scroller = scrollama();
        // setup the instance, pass callback functions
        scroller
          .setup({
            step: '.step' // required - class name of trigger steps
          })
          .onStepEnter(handleStepEnter)
          .onStepExit(handleStepExit);

        function handleFlyTo(value){
            mymap.panTo(warblerWaypoints[value - 1].location, {animate:true, duration: 2})
        }

        function handleStepEnter(e){
            console.log('enter')
            let value = e.element.attributes['data-step'].value
            handleFlyTo(value)

        }

        function handleStepExit(e){
            console.log('exit')
            console.log(e)
        }


            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console