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.

            
              // Author: Ali Soueidan
// Author URI: https//: www.alisoueidan.com

-
    let item = [
        {
            "id": "login",
            "icon": "fas fa-sign-in-alt",
        },
        {
            "id": "love",
            "icon": "fas fa-heart",
        },
        {
            "id": "community",
            "icon": "fas fa-users",
        },
        {
            "id": "photography",
            "icon": "fas fa-camera",
        },
        {
            "id": "communication",
            "icon": "fas fa-comment-alt",
        },
        {
            "id": "call",
            "icon": "fas fa-phone",
        },
    ]

#container 

    h2 Achievement-Box

    .content

        each id, i in item
            .achievement
                .bar
                    .img-box
                        i(class="" + item[i].icon + "")
                    .progress(class="" + item[i].id + "")
                    p 
                        span(class="" + item[i].id + "-counter")
                            | 0
                        | /5 
                        =item[i].id
    
#button-bar 
    each achievement, i in ['login', 'love', 'community', 'photography', 'communication', 'call']
        button(name="" + item[i].id + "" title="click to fill item-achievement bar")
            i(class="" + item[i].icon + "")

a( href='http://bit.ly/2JPuBjx' target="_blank" class='reference' ) 🔗 alisoueidan.com
            
          
!
            
              // Author: Ali Soueidan
// Author URI: https//: www.alisoueidan.com
*
    margin: 0px
    padding: 0px
    box-sizing: border-box
    border: 0px
    outline: 0
    background-repeat: no-repeat
    appearance: none
    border-radius: 0

////
// Gap-Factor
$gap: 10px

////
// Animations

// Standard animation mixin
=animate($name, $delay, $duration, $count:"")
    animation-name: $name
    animation-delay: $delay+s
    animation-duration: $duration+s
    animation-iteration-count: $count
    animation-fill-mode: forwards

// Vibration animation
@keyframes fill 
    0%
        border-radius: 0 $gap*2 $gap*2 0
    50%
        border-radius: 0 $gap*1.5 $gap*1.5 0
    100%
        border-radius: 0 $gap*2 $gap*2 0

////
// Color-Mixins

// Main-Color
$main: rgb(255, 255, 255)

// Sub-Color
=sub( $value, $transparency )
    @if $value == "bg"
        background-color: rgba( 120, 110, 255, $transparency )
    @if $value == "color"
        color: rgba( 120, 110, 255, $transparency )
    @if $value == "fill"
        fill: rgba( 120, 110, 255, $transparency )
    @if $value == "stroke"
        stroke: rgba( 120, 110, 255, $transparency )
    @if $value == "rgba"
        rgba( 120, 110, 255, $transparency )

// Accent-Color
=accent( $value, $transparency )
    @if $value == "bg"
        background-color: rgba( 30, 30, 30, $transparency )
    @if $value == "color"
        color: rgba( 30, 30, 30, $transparency )
    @if $value == "fill"
        fill: rgba( 30, 30, 30, $transparency )
    @if $value == "stroke"
        stroke: rgba( 30, 30, 30, $transparency )
    @if $value == "rgba"
        rgba( 30, 30, 30, $transparency )

// Media-Query mixin
=query( $setsize )
    @media screen and ( min-width: $setsize+px )
        @content

body 
    display: flex 
    flex-direction: column
    justify-content: center 
    align-items: center
    margin: 0
    padding: $gap*2
    box-sizing: border-box
    height: 100vh
    background: radial-gradient(#9E98FE,#93278F)

#container
    margin-bottom: $gap*4
    padding: $gap*2
    width: 100%	
    height: auto
    background: $main
    border-radius: $gap*2
    max-width: 800px
    filter: drop-shadow(0 0 20px rgba(0,0,0,.25))

    h2 
        font-size: 22px
        font-family: 'Open Sans', sans-serif

    .content
        +query(600)
            display: grid
            grid-gap: $gap*2
            grid-template-columns: repeat(2, 1fr)

    .achievement
        margin-top: $gap*2
        width: 100%

        .bar
            position: relative
            display: flex
            align-items: center
            width: 100%
            height: $gap*4
            +accent(bg,.05)
            border-radius: $gap*4
            overflow: hidden

            .img-box 
                position: relative
                z-index: 1
                display: flex
                justify-content: center
                align-items: center
                margin-right: $gap
                width: $gap*4
                height: $gap*4
                +accent(bg,1)
                border-radius: 50%

                i 
                    color: #fff

            p 
                position: relative
                z-index: 1
                +accent(color,1)
                font-size: 18px
                font-family: 'Open Sans', arial, sans-serif

            .progress
                position: absolute
                top: 0
                left: 0
                width: $gap*4
                height: 100%
                background: linear-gradient(30deg, #64a9ff, #93ffa0)
                border-radius: $gap*2
                transition: 1s ease 

                &.running 
                    +animate(fill, 0, 1, $count:"infinite")

#button-bar
    display: grid
    grid-gap: $gap*4
    grid-template-columns: repeat(3, 1fr)
    +query(600)
        grid-gap: $gap*4
        grid-template-columns: repeat(6, 1fr)

    button 
        width: $gap*4
        height: $gap*4
        background: #ffffff
        border-radius: 50%
        filter: drop-shadow(0 0 20px rgba(0,0,0,.25))
        &:hover, &:active, &:focus
            cursor: pointer
            transition: .2s ease
            transform: scale(1.05)
            filter: drop-shadow(0 0 5px rgba(255,255,255,.5))
        i 
            font-size: 1rem


.reference
    position: absolute
    right: $gap 
    bottom: $gap
    color: #fff
    font-family: arial
    text-decoration: none
            
          
!
            
              // Author: Ali Soueidan
// Author URI: https//: www.alisoueidan.com

let progress = document.querySelectorAll("button");

let i = 0;
progress.forEach( function() {

    progress[i].addEventListener( "click", function() {

        let getSelection = this.getAttribute("name");
        let setSelection = document.querySelector("." + getSelection);
        let getCounter = document.querySelector("." + getSelection + "-counter").textContent;
        let setCounter = Number.parseInt(getCounter) + 1;

        let currentWidth = setSelection.style.width;
        let newWidth = Number.parseInt(currentWidth) + 20;

        setSelection.classList.add("running");
        document.querySelector("#container").classList.add("running");

        setTimeout(() => {
            setSelection.classList.remove("running");
            document.querySelector("#container").classList.add("running");
        }, 1000);

        if ( isNaN(newWidth) ) {
            setSelection.style.width = "20%";
        } else {
            if ( newWidth <= 100) {
                setSelection.style.width = newWidth + "%";
            } else {
                setSelection.style.width = "0%";
                setCounter = 0;
            }
        };

        setSelection.getAttribute("style");
        document.querySelector("." + getSelection + "-counter").textContent = setCounter;
    })

    ++i;

})
            
          
!
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