Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2013 17:50
Show Gist options
  • Select an option

  • Save anonymous/6888615 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/6888615 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Oct 8, 2013.
    25 changes: 25 additions & 0 deletions jsbin.UnuQIdU.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    header{
    width:100%;
    height:200px;
    background:teal;
    }

    .ad{
    width:500px;
    height:120px;
    margin:0 auto;
    background:red;
    }
    article{
    width:100%;
    height:1500px;
    background:yellow;
    }

    .ad2{
    width:500px;
    height:120px;
    margin:0 auto;
    background:blue;
    display: none;
    }
    19 changes: 19 additions & 0 deletions jsbin.UnuQIdU.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    <!DOCTYPE html>
    <html>
    <head>
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <meta charset=utf-8 />
    <title>JS Bin</title>
    </head>
    <body>
    <header>
    <div class='ad'></div>
    <div class='ad2'>
    <p> some content</p>
    </div>
    </header>
    <article></article>

    </body>
    </html>

    8 changes: 8 additions & 0 deletions jsbin.UnuQIdU.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    $(function(){
    $(window).scroll(function(){
    var aTop = $('.ad').height();
    if($(this).scrollTop()>=aTop){
    $(".ad2").show();
    }
    });
    });