, blockrain.js er en jquery stik af for lader dig omfatter den klassiske tetris spil på din hjemmeside. et enkelt af blockrain eksempel som vist nedenfor, <!doctype html > < html > < head > < meta - charset = "utf - 8" /> < forbindelse href = http://fonts.googleapis.com/css?family=Play:400,700' rel = 'stylesheet' type = 'text/css'> <link rel = "stylesheet" href = "assets/css/style.css"> <link rel = "stylesheet" href = "src/blockrain.css"> </head> \t <body> \t <section id = "examples"> \t\t <article id = "example-slider"> \t\t\t <div class = "example"> \t\t\t\t <div class = "instructions"> \t\t\t\t\t Use only arrows \t\t\t\t\t\t <div class = "keyboard"> <div class = "key key-up"></div> <div class = "key key-left"></div> <div class = "key key-down"></div> <div class = "key key-right"></div> </div> \t\t\t\t\t\t </div> \t\t\t\t\t <div class = "game" id = "tetris-demo"></div> </div> \t\t\t\t </article> \t\t\t </section> \t\t <script src = "assets/js/jquery-1.11.1.min.js"></script> <script src = "src/blockrain.jquery.libs.js"></script> <script src = "src/blockrain.jquery.src.js"></script> <script src = "src/blockrain.jquery.themes.js"></script> <script> var $cover = $('#cover-tetris').blockrain({ autoplay: true, autoplayRestart: true, speed: 100, autoblockwidth: det er rigtigt, autoblocksize: 25, tema: "slik"}), var versusspeed = 500 dollars, var versus1 = $('# tetris-versus-1. spil "). blockrain ((autoplay: det er rigtigt, autoplayrestart: det er rigtigt, hastighed: versusspeed, ongameover: function() ($versus1. blockrain ('restart) $versus2. blockrain ('restart) var $score = $versus2. parent(). finde (. score) $score. tekst (parseint ($score. text()) + 1)}}) var $versus2 = $('tetris-versus-2. spil"). blockrain ((autoplay: sandt, autoplayrestart: det er rigtigt, versusspeed, hastighed:ongameover: function() ($versus1. blockrain ('restart. $versus2. blockrain ('restart) var $score = $versus1. parent(). finde (. score) $score. tekst (parseint ($score. text()) + 1)}}) var $demo = $('# tetris demo'). blockrain ((hastighed: 20, tema: "sort", onstart: function() (ga ("send", "begivenhed", "tetris, begyndte)}, online: function() (ga (" send "," begivenhed "," tetris. "linje");}, ongameover: funktion (score) (ga ("send", "begivenhed", "tetris", "over" score)}}).$('# eksempel slider). finde (. btn næste). klik (funktion (tilfælde) {begivenhed. preventdefault(); switchdemotheme (korrekt)}); $('eksempel slider). finde (. btn tidligere '). klik (funktion (tilfælde) {begivenhed. preventdefault(); switchdemotheme (forkert)}); funktion switchdemotheme (kommende) (var - temaer = objekt. nøgler (blockrainthemes) var currenttheme = $demo. blockrain ('theme) var currentix = temaer. indexof (currenttheme); hvis (kommende) (currentix + +) andet (currentix...;} hvis (currentix > = themes.length) (currentix = 0} hvis (currentix < 0) (currentix = themes.length-1;} $.o.blockrain ('theme, temaer [currentix]); $('# eksempel slider. tema stærk). tekst (""' + - temaer [currentix] + ")} < /manuskript > < /organ > < /html > det bør føre til følgende resultat −, klik her,
jquery blockrain. er
Previous:jQuery Checkout.js
Next Page:jquery producttour. er