Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <html lang="en">
<!-- 
    Made by Rexford Koduah
    version: 4/20/2018
 -->

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Photo Gallery</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="https://fonts.googleapis.com/css?family=Lato:300,400" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="vendors/css/ionicons.min.css">
    <link rel="stylesheet" type="text/css" href="vendors/css/animate.min.css">
    <link rel="stylesheet" href="resources/css/style.css">

    <link href="data:image/x-icon;base64,AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+4z/L/pMLv//j6/f///////v7//6vG8P+lwu//5u76/3ek5/+70fP///////7+/v+wyvH/daLn/9Hg9////////////////////////////////////////////////////////////////////////////////////////////1SM4f8kbNn/8PX8///////H2vX/CFnU/4yy6v/W4/j/ClvU/4St6f//////y9z2/xVi1v9QiuD/9Pf9////////////////////////////////////////////////////////////////////////////////////////////VIzh/yRs2f/w9fz/9Pf9/z9+3f9Egd7/8/f9/9bj+P8KW9T/hK3p/+7z+/8ob9n/LXLa//D0/P////////////////////////////////////////////////////////////////////////////////////////////////9UjOH/JGzZ/87e9v+Bqun/CVrU/8zc9v//////1uP4/wpb1P9+qej/ZZfk/xdj1v/J2/X//////////////////////////////////////////////////////////////////////////////////////////////////////1SM4f8kbNn/jrPr/zB02/8RX9X/e6bo//X4/f/W4/j/ClvU/2+e5v8faNj/oL/u////////////////////////////////////////////////////////////////////////////////////////////////////////////VIzh/yRs2f/w9fz/+vz+/6zH8P8EVtP/p8Tv/9bj+P8KW9T/cqDm/yRs2f9ek+P/+fv+//////////////////////////////////////////////////////////////////////////////////////////////////////9UjOH/JGzZ//D1/P///////v7//xJf1f9vnuX/1uP4/wpb1P+ErOn/nb3t/wdY1P+cvO3//v7//////////////////////////////////////////////////////////////////////////////////////////////////1SM4f8kbNn/8PX8//7+///J2/X/BFbT/5G17P/W4/j/ClvU/4St6f/5+/7/RoLe/xZi1v/e6fn/////////////////////////////////////////////////////////////////////////////////////////////////VIzh/yRs2f+au+3/RYLe/xdj1v9bkeL/7/T8/9bk+P8MXNX/ha3q///////W4/f/GmXX/0iE3//1+P3///////////////////////////////////////////////////////////////////////////////////////////+70fP/p8Tv/8fZ9f+jwe//xtn1/8nMz/+Ojo7/vcDG/77S8v/f6fn///////7+/v/P3/b/wNT0//T4/f/////////////////////////////////////////////////////////////////////////////////////////////////////////////////39/f/aWlp/9jY2P9ycnL/29vb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////v7+/9LS0v/CwsL/9/f3//r6+v9oaGj/vr6+/2xsbP/f39//7Ozs/729vf/j4+P//v7+//////////////////////////////////////////////////////////////////////////////////////////////////////+7u7v/f39//6CgoP+JiYn//v7+/+Hh4f+pqan/29vb//n5+f9mZmb/qqqq/2xsbP/h4eH//////////////////////////////////////////////////////////////////////////////////////////////////////6urq/+ampr/0NDQ/3d3d//9/f3/rMfw/9nl+P+zzPH/9vb2/2RkZP/c3Nz/eXl5/9jY2P//////////////////////////////////////////////////////////////////////////////////////////////////////9/f3/5mZmf+Li4v/5OTk/+Hr+f+Msuv/ydv1/42y6//u9Pz/ysrK/4aGhv+0tLT//Pz8/////////////////////////////////////////////////////////////////////////////////////////////////////////////Pz8//j4+P/4+v3/XJHi/+Xt+v//////irHq/7nQ8//+/v7/9fX1//7+/v///////////////////////////////////////////////////////////////////////////////////////////////////////////9nZ2f9ra2v/b29v/7e3t//k7fr/bp3l/6C/7v+xyvH//Pz8/42Njf91dXX/eHh4//Dw8P//////////////////////////////////////////////////////////////////////////////////////////////////////o6Oj/7a2tv/t7e3/bW1t//b4/P/U4vf/4Or5/+nw+//z8/P/ZmZm//b29v+FhYX/09PT///////////////////////////////////////////////////////////////////////////////////////////////////////g4OD/eXl5/3l5ef+/v7///Pz8/6Kiov+FhYX/vr6+//39/f+Xl5f/gYGB/4WFhf/z8/P////////////////////////////////////////////////////////////////////////////////////////////////////////////4+Pj/9PT0///////Ozs7/hoaG/97e3v9tbW3/6+vr//39/f/w8PD//f39/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+fn5/9vb2//mpqa/3d3d//09PT//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+Dg4P/IyMj/7e3t////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        rel="icon" type="image/x-icon" />
</head>

<body>
    <!-- NAVBAR -->
    
        <header id="top">
        </header>
        <nav class="navbar nav-style navbar-fixed-top" id="nav-top">
            <div class="container container-style-nav">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed " data-toggle="collapse" data-target="#collapse-here" aria-expanded="false">
                        <i class="ion-ios-search-strong search-icon-nav"></i>
                    </button>
                    <a class="navbar-brand" href="#top">
                        <i class="ion-image ion-image-style"></i>Photo Gallery</a>
                </div>


                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="collapse navbar-collapse" id="collapse-here">
                    <ul class="nav navbar-nav navbar-right nav-list-style" id="nav-lists">
                        <li>
                            <a href="http://rkdevelopment.org" target="_blank">About Me</a>
                        </li>
                    </ul>
                    <form class="navbar-form" id="searchForm-nav" autocomplete="off">
                        <div class="form-group">
                            <input type="text" class="form-control nav-search" placeholder="Search" id="searchText-nav">
                            <button type="submit" class="btn btn-default btn-display-nav">Submit</button>
                        </div>
                    </form>
                </div>
                <!-- /.navbar-collapse -->
            </div>
        </nav>

        <!-- IMAGE search box-->
        <div class="container container-style" id="image-search-box">
            <div class="header">
                <div>
                    <h3 class="text-center">Search For Any Image</h3>
                    <form class="search-container" id="searchForm" autocomplete="off">
                        <i class="ion-ios-search-strong search-icon"></i>
                        <input type="text" class="form-control " id="searchText" placeholder="Search Image Here">
                        <button type="submit" class="btn btn-default btn-display">Submit</button>
                    </form>
                    <h4 class="from-pixabay">Images from Pixabay</h4>
                </div>
                <div class="paginations">
                    <a href="#" id="pagination1">Previous</a>
                    <p class="pageNumber">Page 1</p>
                    <a href="#" id="pagination2">Next</a>
                </div>
            </div>
            <!-- IMAGES GO HERE -->
            <div class="masonry" id="image-container">

            </div>
        </div>


        <!--SECTION FOOTER -->
        <footer class="footer-section animated fadeIn" id="contact">
            <div class="rows-container">
                <div class="footer-con">
                    <div class="homepage-link">
                        <a href="http://rkdevelopment.org">
                            <h3>Rkdevelopment.org</h3>
                        </a>
                    </div>

                    <ul class="social-list center">
                        <li>
                            <a href="https://github.com/RexfordK" target="_blank">
                                <i class="ion-social-github"></i>
                            </a>
                        </li>
                        <li>
                            <a href="https://www.linkedin.com/in/rexford-koduah" target="_blank">
                                <i class="ion-social-linkedin"></i>
                            </a>
                        </li>
                        <li>
                            <a href="https://www.freecodecamp.org/rexfordk" target="_blank">
                                <i class="ion-fireball"></i>
                            </a>
                        </li>
                    </ul>
                    <p>Copyright &copy; 2018 by Rexford Koduah. All rights reserved.</p>
                </div>
            </div>

        </footer>
    
    <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
        crossorigin="anonymous"></script>
    <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
    <script src="resources/js/main.js"></script>

</body>

</html>
              
            
!

CSS

              
                /*
BugFixes
*/

html,
body {
    -webkit-overflow-scrolling: touch !important;
    overflow: auto !important;
    height: 100% !important;
}

body.iosBugFixCaret {
    position: fixed;
    width: 100%;
}

/*
REUSABLE
*/

* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

body {
    font-family: 'Lato', 'Ariel', 'sans-serif';
    color: black;
    overflow-x: hidden;
    font-size: 18px;
    padding-top: 0;
}

h1 {
    font-family: 'Roboto Slab', serif;
    font-size: 36px;
    font-weight: 700;
}

h2 {
    font-weight: 700;
}

h5,
h5 {
    font-size: 20px;
    font-weight: 700;
}

.jumbotron h3 {
    font-size: 24px;
    font-weight: 600;
}

.center {
    text-align: center;
}

.js--no-display {
    display: none;
}

.bold {
    font-weight: 600;
}

.container:before,
.container:after {
    content: "";
    display: table;
}

.container:after {
    clear: both;
}

/*
NAVBAR AREA
*/

.brand-logo {
    color: #333;
    text-decoration: none;
}

.brand-logo h1 {
    font-size: 36px;
    font-weight: 700;
}

.brand-logo:active,
.brand-logo:focus,
.brand-logo:hover {
    text-decoration: none;
    color: #d35400;
}

.nav-style {
    background-color: #2c3e50;
    border-color: #080808;
    color: white;
    /* opacity: 0.95; */
    -webkit-box-shadow: 0 2px 2px black;
    -moz-box-shadow: 0 2px 2px black;
    box-shadow: 0 2px 1px #3e5771;
    border-radius: 0;
}

.navbar-brand {
    margin-top: 8px;
    padding-top: 12px;
}

.navbar-collapse {
    border-top: none;
}

.navbar-form {
    border-bottom: none;
    margin-top: 0;
    margin-bottom: 0;
}

.search-icon-nav {
    padding: 5px 10px 5px 0;
    margin-right: 20px;
    background-image: none;
    font-size: 1.3em;
}

.ion-image-style {
    padding-right: 10px;
    font-size: 1.2em;
}

.nav>li>a:focus,
.nav>li>a:hover {
    background-color: transparent;
}

.nav-list-style {
    padding-top: 10px;
}

.nav-list-style li a {
    color: white;
}

#searchText-nav {
    font-size: 18px;
    font-size: 18px;
    display: inline-block;
    width: 72%;
}

.btn-display-nav {
    width: 25%;
    background-color: #3e5771;
    color: white;
    position: relative;
    border-radius: 10px;
    bottom: 3px;
    right: -6px;
}

.btn-display-nav:focus {
    background-color: #3e5771;
}

/* 
SEARCH BOX
*/

.container-style {
    padding-top: 70px;
}

.from-pixabay {
    text-align: center;
    font-size: 80%;
    padding-bottom: 0;
}

.header {
    background-color: #fff;
    border-bottom: 3px double #333;
    padding: 20px;
    margin: 2em 0;
}

.search-container {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    width: 100%;
}

.search-icon {
    padding: 5px 10px;
    height: 34px;
    background-image: none;
}

#searchText {
    font-size: 18px;
}

.paginations {
    width: 35%;
    margin: 0 auto;
    overflow-y: auto;
    text-align: center;
}

.paginations a {
    padding: 5px 7px;
    border: 2px solid #333;
    border-radius: 10px;
    color: black
}

.paginations a:link,
.paginations a:focus,
.paginations a:hover {
    text-decoration: none;
    color: inherit;
}

#pagination1 {
    float: left;
}

#pagination2 {
    float: right;
    position: relative;
    right: 34px;
}

.pageNumber {
    display: inline-block;
    padding-top: 7px;
    padding-right: 32px;
}

.btn-display {
    background-color: #3e5771;
    color: white;
    border-radius: 2px 2px 2px 0;
}

.btn-display:focus {
    background-color: #3e5771;
}

/*
IMAGE CONTAINER
*/

.masonry {
    /* transition: all 5s ease-in-out; 
    -webkit-transition: all 5s ease-in-out;
    -moz-transition: all 5s ease-in-out; */
    column-gap: 0.5em;
    -webkit-column-gap: 0.5em;
    -moz-column-gap: 0.5em;
    column-fill: balance;
    -webkit-column-fill: balance;
    -moz-column-fill: balance;
    background-color: #eee3;
}

.brick {
    padding-bottom: 0.5em;
}

/* animation */

.brick {
    -webkit-animation-duration: 1.75s;
    -moz-animation-duration: 1.75s;
    animation-duration: 1.75s;
    -webkit-animation-delay: 1.25s;
    -moz-animation-delay: 1.25s;
    animation-delay: 1.25s;
}

#contact {
    -webkit-animation-duration: 1.75s;
    -moz-animation-duration: 1.75s;
    animation-duration: 1.75s;
    -webkit-animation-delay: 1.25s;
    -moz-animation-delay: 1.25s;
    animation-delay: 1.25s;
}

/* animation end */

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

/*
Footer
*/

footer {
    text-align: center;
    margin-top: 40px;
    position: relative;
    width: 100%;
    bottom: -66px;
    opacity: 0;
}

a:link,
a:focus {
    text-decoration: none;
    color: inherit;
}

.homepage-link {
    width: 100%;
    margin: 0;
}

.homepage-link h3 {
    display: inline-block;
    margin: 0;
    letter-spacing: 1.75px;
    font-weight: 600;
}

footer h3:hover {
    color: #d35400;
}

.footer-con {
    padding: 20px 0 10px;
}

footer {
    background-color: #1a1a1a;
}

.footer-section,
.footer-section p {
    color: #eee;
}

.social-list {
    list-style: none;
    display: inline-block;
    padding: 5px;
    margin-bottom: 0;
}

.social-list li {
    float: left;
    padding: 10px 20px;
    font-size: 200%;
}

.social-list li a {
    color: #6e6e6e;
}

.ion-social-github:hover,
.ion-social-github:active {
    color: #050505;
}

.ion-social-linkedin:hover,
.ion-social-linkedin:active {
    color: #007bb5;
}

.ion-fireball:hover,
.ion-fireball:active {
    color: darkgreen;
}

/*
MEDIA QUERIES
*/

@media only screen and (min-width: 1280px) {
    .paginations {
        width: 35%;
    }
}

@media only screen and (min-width: 990px) {
    .masonry {
        -webkit-column-count: 3;
        -moz-column-count: 3;
        column-count: 3;
    }
    .container-style {
        width: 85%;
        padding: 70px 2em 2em 2em;
        margin: 0 auto;
    }
    .container-style-nav {
        width: 85%;
        padding: 0 2em;
    }
    .paginations {
        width: 45%;
    }
    .pageNumber {
        width: 139px;
    }
}

@media only screen and (min-width: 468px) and (max-width: 1000px) {
    .masonry {
        -webkit-column-count: 2;
        -moz-column-count: 2;
        column-count: 2;
    }
    .container-style {
        width: 95%;
        padding: 70px 2em 2em 2em;
        margin: 0 auto;
    }
    .container-style-nav {
        padding: 0 2em;
        width: 95%;
    }
    .paginations {
        width: 48%;
    }
    .brick img {
        max-height: 400 px;
    }
}

@media only screen and (min-width: 819px) and (max-width: 1000px) {
    .paginations {
        width: 48%;
    }
}

@media only screen and (max-width: 819px) {
    .paginations {
        width: 70%;
    }
}

@media only screen and (min-width: 768px) {
    .nav-search {
        display: none !important;
    }
    .btn-display-nav {
        display: none !important;
    }
}

@media only screen and (max-width: 768px) {
    .nav-search {}
    .header {
        padding-top: 15px;
        margin-top: 0;
    }
    .nav-style {
        border-radius: 0 0 4px 4px;
    }
    body {
        padding-top: 0;
    }
}

@media only screen and (max-width: 629px) {
    .paginations {
        width: 100%;
    }
    #pagination2 {
        position: unset;
        right: 0;
    }
    .from-pixabay {
        padding-left: 5px;
    }
    .search-icon {
        display: none;
    }
}

@media only screen and (max-width: 468px) {
    .container-style {
        width: 100%;
    }
    .header {
        /* margin-top: 0; */
    }
    .paginations {
        font-size: 16px;
    }
    .pageNumber {
        padding-right: 8px;
    }
    #pagination2 {
        position: unset;
        right: 0;
    }
    .from-pixabay {
        padding-left: 20px;
    }
}

@media only screen and (max-width: 339px) {
    .paginations {
        font-size: 11px;
    }
    #searchText-nav {
        width: 62%;
        bottom: 2px;
        right: -13px;
    }
}
              
            
!

JS

              
                $(document).ready(function () {
    var searchValue = "rice"
    var defaultPage = 1;
    
    // fixedTop();
    smoothScrolling();
    closeNavOnClick();
    searchSubmit(searchValue,defaultPage);
    returnPhotos(searchValue, defaultPage);
    // console.log(searchValue);

});

/*
1. Return Photos from pixabey API
*/
function returnPhotos(searchValue, pageNum) {
    let key = "8712269-5b0ee0617ceeb0fd2f84487c3";
    let startURL = "https://pixabay.com/api/?key=" + key;
    let page = "&page=" + pageNum;
    let imagesPerPage = "&per_page=" + 22
    let addWH = "&min_width&min_height";
    let safeSearch = "&safesearch=true";
    let endingURL = "&q=" + searchValue + page + addWH + safeSearch + imagesPerPage;

    // activate api and get data
    $.getJSON(startURL + endingURL, function (data) {
        let image = data.hits;
        // var imageLength = image.length;
        arrayLength = image.length;

        if (arrayLength >=1) {
            let output = ""
            for (let x = 0; x < arrayLength; x++) {

                //imageObject contains information on each image passed through the array
                let imageObject = {
                    // id: image[x].id,
                    // pageURL: image[x].pageURL,
                    // tags: image[x].tags,
                    // previewURL: image[x].previewURL,
                    // previewWidth: image[x].previewWidth,
                    // previewHeight: image[x].previewHeight,
                    webformatURL: image[x].webformatURL,
                    // webformatWidth: image[x].webformatWidth,
                    // webformatHeight: image[x].webformatHeight,
                    largeImageURL: image[x].largeImageURL,
                    // fullHDURL: image[x].fullHDURL,
                    // views: image[x].views,
                    // user_id: image[x].user_id,
                    // user: image[x].user,
                    // userImageURL: image[x].userImageURL
                }

                // output this template to the website
                output += `
                    <div class="brick animated fadeIn">
                        <a href="${imageObject.largeImageURL}">
                            <img src="${imageObject.webformatURL}">
                        </a>
                    </div>
                `
            }

            let img = $("#image-container");
            img.addClass("masonry");
            $("footer").css("margin-top", 40);
            img.html(output);
            // console.log("success");
        } else {
            let output2 = `
            <div class="col-md-12 animated fadeIn">
                <h1>404 sorry can't find any images</h1>
            </div>
        `
        $(".masonry").html(output2);
        $(".masonry").removeClass("masonry");
        $("#image-container").addClass("center");
        $("footer").css("margin-top", 88);
            // console.log("Didn't work");
        }
        getPage(searchValue, pageNum, arrayLength);
        console.log("This is the arraylength: " + arrayLength);
    });
}

/*
2. Search Boxes on Submit: Return Photos
*/
function searchSubmit(searchValue,defaultPage){
    $("#searchForm, #searchForm-nav").on("submit", function (event) {
        //obtain value from user input
        searchValue = $("#searchText").val();
        $("#searchText").val("");
        if (!searchValue) {
            searchValue = $("#searchText-nav").val();
            $("#searchText-nav").val("");
        }

        $(".pageNumber").html("Page " + 1);
        returnPhotos(searchValue, defaultPage);

        //closes navbar on submit and link click
        $(".navbar-collapse").collapse('hide');
        $('html, body').animate({
            scrollTop: $("#top")
        });
        //stops form from submitting to a file & resets value
        event.preventDefault();
    });
}


/*
3. INCREASE/Decrease PAGE NUMBER
*/
function getPage(searchValue, defaultPage, max) {
    if (defaultPage <= max + 1) {
        $("#pagination2").off("click").on("click", function () {
            if (defaultPage <= max) {
                let end = max + 1;
                defaultPage++;
                returnPhotos(searchValue, defaultPage);
                // $(".pageNumber").html("Page " + defaultPage + " of " + end);
                $(".pageNumber").html("Page " + defaultPage);
                // console.log("This is the default page:", defaultPage);
            };
        });

    }

    $("#pagination1").off("click").on("click", function () {
        if (defaultPage != 1) {
            let end = max + 1;
            defaultPage--;
            returnPhotos(searchValue, defaultPage);
            // $(".pageNumber").html("Page " + defaultPage + " of " + end);
            $(".pageNumber").html("Page " + defaultPage);
        }
        // console.log("This is the default page:", defaultPage);
    });
}

/*
ACCESSORY FUNCTIONS
*/
function smoothScrolling() {
    /*
    -smooth page scrolling -
    */
    // Select all links with hashes
    $('a[href*="#"]')
        // Remove links that don't actually link to anything
        .not('[href="#"]')
        .not('[href="#0"]')
        .click(function (event) {
            // On-page links
            if (
                location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') &&
                location.hostname == this.hostname
            ) {
                // Figure out element to scroll to
                var target = $(this.hash);
                target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
                // Does a scroll target exist?
                if (target.length) {
                    // Only prevent default if animation is actually gonna happen
                    event.preventDefault();
                    $('html, body').animate({
                        scrollTop: target.offset().top
                    }, 1200, function () {
                        // Callback after animation
                        // Must change focus!
                        var $target = $(target);
                        $target.focus();
                        if ($target.is(":focus")) { // Checking if the target was focused
                            return false;
                        } else {
                            $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable
                            $target.focus(); // Set focus again
                        };
                    });
                }
            }
        });
}

function fixedTop(){
    $(window).resize(function(){
        if ($(window).width() <= 760){	
            $("#nav-top").addClass("navbar-fixed-top");
        }	
    });
}

function closeNavOnClick(){
    $("#nav-lists a").click(function(){
        $(".navbar-collapse").collapse('hide');
    });
}

function iosBugFix(){
    var ua = navigator.userAgent,
    iOS = /iPad|iPhone|iPod/.test(ua),
    iOS11 = /OS 11_0|OS 11_1|OS 11_2/.test(ua);

    // ios 11 bug caret position
    if ( iOS && iOS11 ) {

        // Add CSS class to body
        $("body").addClass("iosBugFixCaret");

    }


}
              
            
!
999px

Console