Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

Auto Save

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.

HTML

              
                <body>
    <div class="wrap">
        <div class="nav">
            <div class="header">
                <div class="title">
                    <h1>第十二屆鐵人賽</h1>
                </div>
                <ul class="menu">
                    <li><a href="#">首頁</a></li>
                    <li><a href="#frontEnd">三隻箭</a></li>
                    <li><a href="#data">累績數據</a></li>
                </ul>    
            </div>
        </div>
        <div class="pics">
            <h2>第十二屆鐵人賽</h2>
                <div class="logo">
                <img src="https://www.flaticon.com/svg/static/icons/svg/2693/2693110.svg" alt="鐵人">
            </div>
        </div>
        <div class="threePoint" id="frontEnd">
            <div class="content">
                <h2>前端三隻箭</h2>
                <div class="frontEnd">
                    <img src="https://www.flaticon.com/svg/static/icons/svg/919/919827.svg" alt="html">
                    <img src="https://www.flaticon.com/svg/static/icons/svg/919/919826.svg" alt="css">
                    <img src="https://www.flaticon.com/svg/static/icons/svg/919/919828.svg" alt="js">
                </div>     
            </div>
        </div>
        <div class="container">
            <div class="data" id="data">
                <div class="me">
                    <img src="https://www.flaticon.com/svg/static/icons/svg/2945/2945506.svg" alt="我">
                </div>
                <ul class="skill">
                    <li>
                        <p>HTML</p>
                        <div class="loading">
                            <div>5篇</div>
                        </div>
                    </li>
                    <li>
                        <p>CSS</p>
                        <div class="loading">
                            <div>5篇</div>
                        </div>
                    </li>
                    <li>
                        <p>jQuery</p>
                        <div class="loading">
                            <div>5篇</div>
                        </div>
                    </li>
                    <li>
                        <p>JavaScript</p>
                        <div class="loading">
                            <div>10篇</div>
                        </div>
                    </li>
                    <li>
                        <p>RWD</p>
                        <div class="loading">
                            <div>5篇</div>
                        </div>
                    </li>
                    <li>
                        <p>綜合練習</p>
                        <div class="loading">
                            <div>3篇</div>
                        </div>
                    </li>
                    <li>
                        <p>總天數</p>
                        <div class="loading">
                            <div>28天</div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <div class="icon">Icons made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
    </div>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
              
            
!

CSS

              
                img{
    max-width: 100%;
    height: auto;
}
*,*::before,*::after{
    box-sizing: border-box;
}
.wrap{
    width: 100%;
    height: auto;
    font-family: 微軟正黑體;
    background-image: url(https://cdn.pixabay.com/photo/2020/05/19/12/04/work-5190435_1280.jpg);
    background-position: left bottom;
    background-size: cover;
    background-attachment: fixed;
    font-weight: bold;
}
.nav{
    width: 100%;
    background-color: #7d807e;
    position: fixed;
}
.nav .header{
    max-width: 960px;
    height: 44px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    color: #f8f8f1;
}
.nav .header .title{
    font-size: 20px;
    line-height: 44px;
}
.nav .header .menu{
    display: flex;
}
.nav .header .menu li a{
    display: block;
    text-decoration: none;
    text-align: center;
    padding: 14px 15px;
    color: #f8f8f1;
}
.nav .header .menu li a:hover{
    background-color: #f39356;
}
.pics{
    width: 600px;
    margin: 0px auto;
    padding-top: 124px;
}
.pics h2,.threePoint h2{
    color: #ffffff;
    text-align: center;
    font-size: 24px;
    line-height: 40px;
    padding: 10px;
    margin: 80px 0 20px;
}
.pics .logo img{
    display: block;
    width: 27%;
    height: auto;
    margin: 0 auto;
}
.threePoint{
    width: 100%;
    background-color:rgba(255, 191, 116,.8);
}
.threePoint h2{
    color: #000000;
    padding:80px 0 20px;
}
.threePoint .frontEnd{
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    padding-bottom: 80px;
}
.data{
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    padding: 70px 0;
}
.data .me{
    width: 30%;
}
.data .skill{
    width: 68%;
    color: #ffffff;
}
.data .me img{
    padding: 40px;
}
.data .skill li p{
    font-size: 20px;
    padding: 10px;
}
.data .skill li .loading{
    max-width: 600px;
    height: 30px;
    border-radius: 7px;
    background-color: #d3d3d3;
}
.data .skill li .loading div{
    width: 0%;
    overflow: hidden;
    text-align: center;
    line-height: 30px;
    border-radius: 7px;
    background-color: #ef8354;
    transition: all 1s .3s ease;
}
.data .skill .html .loading div{
    width: 30%;
}
.data .skill .css .loading div{
    width: 30%;
}
.data .skill .jquery .loading div{
    width: 30%;
}
.data .skill .js .loading div{
    width: 60%;
}
.data .skill .rwd .loading div{
    width: 30%;
}
.data .skill .total .loading div{
    width: 12%;
}
.data .skill .day .loading div{
    width: 90%;
}
              
            
!

JS

              
                var lis = document.querySelectorAll(".data .skill li");
var classNames = ["html","css","jquery","js","rwd","total","day"];
var len = lis.length;

window.addEventListener("scroll",function(){
    var y = window.scrollY;
    console.log(y);
    if(y>500){
        for(var i=0;i<len;i++){
            lis[i].className = classNames[i];
        }     
    }
},false)


$(".nav .header .menu li a").click(function (e) { 
    e.preventDefault();
    var target =  $(this).attr("href");
    switch(target){
            case "#":
                $("html,body").animate({
                    scrollTop:0
                  },800);
                break;
            case "#frontEnd":
                $("html,body").animate({
                    scrollTop:484
                  },800);
                break;
            default:
                $("html,body").animate({
                    scrollTop:810
                  },800);
                break;
            }
});



              
            
!
999px

Console