JSFiddle - React, Tailwind, and code Playground

by b2550

HTML

<img id="logo" src="http://tekstovi-pesama.com/g_img2/0/h/170744/hash-2.jpg" />

JavaScript

//Logo Changer
window.onload       = checkHash;
window.onhashchange = checkHash;


function checkHash() {
    var hash  = window.location.hash;
    var image = $("#logo");

    //Home Hashes
    var home = [
        "#home",
        "#news",
        "#team",
        "#cont",
        "#about",
        "#FAQ"];
    
    //Entertainment Hashes
    var ent = [
        "#ent"];


    //SEPERATOR------------------------------------------
    
    
    //Home Fader
    if (home.indexOf(hash) > -1) {
        image.fadeOut('fast', function () {
            image.attr('src', 'http://alaan24.com/alaan_img/alaan_1374489621.jpg');
            image.fadeIn('fast');
        });
    } 
    else if (ent.indexOf(hash) > -1) {
        image.fadeOut('fast', function() {
            image.attr('src', 'http://nbn64.com/images/logo.png');
            image.fadeIn('fast');
        });
    }
}

// To simulate page change, since jsFiddle uses Iframes
// Change the hash to whatever you want
setTimeout(function(){
    window.location = "#ent";
}, 8000);