Javascript-форум (https://javascript.ru/forum/)
-   Ваши сайты и скрипты (https://javascript.ru/forum/project/)
-   -   Прошу оценить код моей javascript игры ) (https://javascript.ru/forum/project/48802-proshu-ocenit-kod-moejj-javascript-igry.html)

рони 18.07.2014 14:07

colmer,
рамка при фокусе в инпут
.welcome input {
width: 400px;
margin: 20px 0 0 50px;
height: 30px;
font-size: 30px;
line-height: 30px;
border-radius: 10px;
outline: none;
}

рони 18.07.2014 14:09

colmer,
как вариант ...
$( document ).ready(function() {

    $(".chuse").click( function() {
    		$(".welcome").fadeOut( function() {
    			$(".weapons").fadeIn();
    		} );
    });
    $("input").on("input",function() {
       var name = $.trim(this.value);
       this.value = name ;
       player.nickname = name;
       $(".chuse").prop({"disabled" : !name}).text(name ? "Начать" : "Выбрать").css({"fontSize" : name ? "12px" : "24px"}).stop(true, true).animate({"fontSize": name ? "24px" : "12px"},600)
    })



    var inventory = function (chose) {

colmer 18.07.2014 15:55

Цитата:

Сообщение от рони (Сообщение 321642)
colmer,
как вариант ...
$( document ).ready(function() {

    $(".chuse").click( function() {
    		$(".welcome").fadeOut( function() {
    			$(".weapons").fadeIn();
    		} );
    });
    $("input").on("input",function() {
       var name = $.trim(this.value);
       this.value = name ;
       player.nickname = name;
       $(".chuse").prop({"disabled" : !name}).text(name ? "Начать" : "Выбрать").css({"fontSize" : name ? "12px" : "24px"}).stop(true, true).animate({"fontSize": name ? "24px" : "12px"},600)
    })



    var inventory = function (chose) {

Если .css({"fontSize" : name ? "12px" : "24px"}) оставить, получается бешенная кнопка))) При каждом нажатии уменьшает и увеличивает текст, оставил :

$(".chuse").prop({"disabled" : !name}).text(name ? "В бой" : "Ввести").stop(true, true).animate({"fontSize": name ? "24px" : "12px"},600);
:)


Часовой пояс GMT +3, время: 02:35.