css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

<div class="row" id="buttons-container">
    <button class="btn" id="fahrenhiet-button">F°</button>
    <button class="btn btn-primary" id="celsuis-button">C°</button>
<div class="container text-center">
    <span style="font-size : 30px" id="date"></span><br>
    <span style="font-size : 50px" id="location"></span><br>
    <span style="font-size : 150px" id="temp"></span><br>
    <img id="weatherIcon"><br>
    <span style="font-size : 30px" id="weatherCondition"></span><br>
    <span style="font-size : 25px" id="windSpeed"></span>

<div class="panel-footer Transparency">
        <span><i>Powred by <a href='https://openweathermap.org/' target='_blank'><img src="https://www.esolve.co.za/images/assets/logo_OpenWeatherMap_orange_website.png" width="240" height="30" id="openWeatherMapLogo"></a>,  Created by 
    <a href='https://github.com/sendja-3360' target='_blank'>SENDJASNI</a></i></span>
              body {
    margin-top: 5%;
    font-family:  Arial, sans-serif;

#buttons-container {
    position: fixed;
    padding-left: 10%;
    top : 0%;

.center {
    position: relative;
    margin-top: 10%;
    width: 60%;
    margin-left: 20%;

.Transparency {
    background-color: rgba(90, 125, 0, 0.5);


span {
  color : #200000;
.panel-footer {
    position: absolute;
    width: 100%;
    bottom: 0%;
    left: 0%;
    text-align: center;



$(document).ready(function () {
    var data;

    //get the lat and long 
      function initGeolocation(){
        if( navigator.geolocation ){
           // Call getCurrentPosition with success and failure callbacks
           navigator.geolocation.getCurrentPosition( success, fail );
        }else {
           alert("Sorry, your browser does not support geolocation services.");
    }function success(position){

        var longitude = position.coords.longitude;
        var latitude = position.coords.latitude
         getCityId(latitude, longitude);
    }function fail(){
        // Could not obtain location
         alert("Sorry, something went wrong Could not obtain location.");
    //get the data from the openWeatherMap API
    function getCityId(lat, lon) {
        var link = 'http://api.openweathermap.org/data/2.5/weather?lat=' + lat + '&lon=' + lon + '&APPID=f6d4f74a914927bf429602afcac80854';

        $.getJSON(link, function (json) {
            $.getJSON('http://api.openweathermap.org/data/2.5/weather?id='+json.id+'&APPID=f6d4f74a914927bf429602afcac80854', function(weather){
            data = json;

    //Display the data in the web page
    function displayData(data) {
        // getting the current date
        var date = new Date();
        var strDate = (GetMonthName(date.getMonth()+1)) +' '+ date.getDate() +', '+date.getFullYear();
        var temp =  kelvinToCelsuis(data.main.temp) + " C°";
        var windSpeed = 'Wind Speed : ' + data.wind.speed + ' Mph';
        var strWeatherCon = data.weather[0].description;
        var weatherCondition = strWeatherCon[0].toUpperCase() + strWeatherCon.slice(1);
        var location = data.name +', '+ data.sys.country;

        $('#weatherIcon').attr('src', 'http://openweathermap.org/img/w/'+data.weather[0].icon+'.png');

        //changing the background


    //convert temp from kelvin to celsuis
    function kelvinToCelsuis(temp) {
        return Math.round(temp - 273.15);

    //convert temp from kelvin to fahrenhiet
    function kelvinToFahrenhiet(temp) {
        var fahrenTemp = ((temp * 9) / 5) - 459.67
        return Math.round(fahrenTemp);
    //activating the button to display the temp with the desire metric  
    $('div button').on('click', function () {
    //changing the display metric to fahrenhiet
    $('#fahrenhiet-button').on('click', function(){
            $('#temp').html(kelvinToFahrenhiet(data.main.temp) + "  F°");
    //changing the display metric to celsuis
    $('#celsuis-button').on('click', function(){
            $('#temp').html(kelvinToCelsuis(data.main.temp) + "  C°");
    //converting numbers to month name
    function GetMonthName(monthNumber) {
        var months = ['January', 'February', 'March', 'April', 'May', 'June',
                     'July', 'August', 'September', 'October', 'November', 'December'];
        return months[monthNumber - 1];
    function changeBackground(discription){
        var link;
          if(val.id == discription)
              link = val.link;
        $('body').css("background-image", "url("+link+") 100% 100%");  

    //sarting the sevice


var backgrounds = [  
      "id":"clear sky",
      "id":"few clouds",
      "id":"scattered clouds",
      "id":"broken clouds",
     "id":"few clouds",
   {  "id":"overcast clouds",
     "id":"light rain",
      "id":"shower rain",

🕑 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.
Loading ..................