Skip to content

Instantly share code, notes, and snippets.

@pawelmhm
Created January 18, 2013 14:29
Show Gist options
  • Save pawelmhm/4564901 to your computer and use it in GitHub Desktop.
Save pawelmhm/4564901 to your computer and use it in GitHub Desktop.

Revisions

  1. pawelmhm revised this gist Jan 19, 2013. 1 changed file with 11 additions and 3 deletions.
    14 changes: 11 additions & 3 deletions dabblet.js
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,19 @@
    (function () {
    var diver = document.getElementById('classer');
    var IntervalId;
    var oczy = ["niebieskie", "czarne", "zielone"];

    IntervalId = setInterval(flashtext,200);


    function flashtext() {
    diver.style.background = diver.style.background == "purple" ? "red" : "purple";
    }
    for (var i=0;i<oczy.length; i++) {
    message = i + ". "+ "Moje oczy sa " + oczy[i];
    diver.innerHTML = message;
    }

    }

    //function flashtext() {
    //diver.style.background = diver.style.background == "purple" ? "red" : "purple";
    //}
    })();
  2. pawelmhm revised this gist Jan 19, 2013. 2 changed files with 6 additions and 11 deletions.
    2 changes: 0 additions & 2 deletions dabblet.css
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,6 @@
    * The first commented line is your dabblet’s title
    */
    #classer {
    background: #f06;
    background: linear-gradient(45deg, #f06, yellow);
    width:300px;
    height:300px;
    margin:auto;
    15 changes: 6 additions & 9 deletions dabblet.js
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,11 @@
    (function () {
    var diver = document.getElementById('classer');
    var colorki = ['red','purple','powderblue','violet'];
    diver.onmouseout = run;
    function run() {diver.style.background = colorki[1];}

    function eleme () {
    var IntervalId;

    IntervalId = setInterval(flashtext,200);

    for (var i=0;i<colorki.length;i++) {
    setInterval(function(){diver.style.background = colorki[i];},20);

    }

    function flashtext() {
    diver.style.background = diver.style.background == "purple" ? "red" : "purple";
    }
    })();
  3. pawelmhm revised this gist Jan 19, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion dabblet.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,8 @@
    (function () {
    var diver = document.getElementById('classer');
    var colorki = ['red','purple','powderblue','violet'];
    diver.onclick = eleme;
    diver.onmouseout = run;
    function run() {diver.style.background = colorki[1];}

    function eleme () {

  4. pawelmhm revised this gist Jan 18, 2013. 1 changed file with 13 additions and 13 deletions.
    26 changes: 13 additions & 13 deletions dabblet.js
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    var diver = document.getElementById('classer');
    var colorki = ['red','purple','powderblue','violet'];

    diver.onmouseout = ini;
    //an exercise in arrays, each color will be displayed for 30 seconds;
    function ini () {
    for (i=0;i<colorki.length;i++) {
    function switcher () {
    diver.style.background = colorki[i];}
    setInterval(switcher, 30);
    }
    }
    (function () {
    var diver = document.getElementById('classer');
    var colorki = ['red','purple','powderblue','violet'];
    diver.onclick = eleme;
    function eleme () {
    for (var i=0;i<colorki.length;i++) {
    setInterval(function(){diver.style.background = colorki[i];},20);
    }
    }
    })();
  5. pawelmhm created this gist Jan 18, 2013.
    10 changes: 10 additions & 0 deletions dabblet.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    /**
    * The first commented line is your dabblet’s title
    */
    #classer {
    background: #f06;
    background: linear-gradient(45deg, #f06, yellow);
    width:300px;
    height:300px;
    margin:auto;
    }
    5 changes: 5 additions & 0 deletions dabblet.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    <!-- content to be placed inside <body>…</body> -->

    <div id="classer">

    </div>
    13 changes: 13 additions & 0 deletions dabblet.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    var diver = document.getElementById('classer');

    var colorki = ['red','purple','powderblue','violet'];

    diver.onmouseout = ini;
    //an exercise in arrays, each color will be displayed for 30 seconds;
    function ini () {
    for (i=0;i<colorki.length;i++) {
    function switcher () {
    diver.style.background = colorki[i];}
    setInterval(switcher, 30);
    }
    }
    1 change: 1 addition & 0 deletions settings.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    {"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"}