JSFiddle

  • jQuery example lesson 1

    tutoring jquery addClass and removeCalss

    $(function() {
        $('p').click(function(){
            var eleClass = $(this).attr('class');
            if(eleClass === 'white')
            {
               $(this).removeClass('white').addClass('black');        
            } else{
                 $(this).removeClass ...
  • micro-optimization - loop - pattern

    No-Library (pure JS), HTML, CSS, JavaScript

    //first pattern
    var i, myarray = [];
    for(i = myarray.length; i--;){
         //do something   
    }
    //second way
    var myarray = [],
        i = myarray.length;
    
    while ...
  • Anitpatterns Globals and delete

    Testing Antipatterns in globals and the ability to delete

    var globalOne = 0;
    globalTwo = 3;
    
    //attempt to delete
    delete globalOne;
    delete globalTwo;
    //test
    alert(typeof globalOne);//does not get deleted ...
  • Test simple Parallax effect #5 is the latest revision

    jQuery 1.9.1, HTML, CSS, JavaScript

    function animateThis() {
        $('#top').css("background-position", "-=2");
        $('#mid').css("background-position", "-=8");
        $('#bottom').css("background-position", "-=12");
    }
    
    setInterval(animateThis, 100);
  • Sprite animation with jQuery #8 is the latest revision

    jQuery 1.9.1, HTML, CSS, JavaScript

    $(function () {
        var interval = "";
        var out = "";
        //set up the starting background positions
        var xpos = 0;
        var ypos = 0;
        //on hover
        $('.sprite ...