Показать сообщение отдельно
  #10 (permalink)  
Старый 15.01.2019, 17:09
Интересующийся
Отправить личное сообщение для TheOwl Посмотреть профиль Найти все сообщения от TheOwl
 
Регистрация: 20.11.2018
Сообщений: 15

Я наверное не смогу все объяснить, посмотри...

это мой учебный преокт https://github.com/Sunantby/my-projects/tree/for-forum

data.js
'use strict'; 
 
var playerEyes = document.querySelector('.overlay').querySelector('.wizard-eyes');
var playerCoat = document.querySelector('.overlay').querySelector('.wizard-coat');
var playerFireball = document.querySelector('.overlay').querySelector('.setup-fireball');
var inputColorCoat = document.querySelector('.input-color-coat');
var inputColorFireball = document.querySelector('.input-color-fireball');
var inputColorEyes = document.querySelector('.input-color-eyes');
      playerFireball.setAttribute('style', 'background-color:#ee4830');
(function() {
 
 
        window.writeObj = function() {
            playerColorsSetup.coat = inputColorCoat.value;
            playerColorsSetup.fireball = inputColorFireball.value;
            playerColorsSetup.eyes = inputColorEyes.value;
        };
 
        window.writeSetup = function () {
            playerCoat.style.fill = playerCoat.style.fill || 'rgb(101, 137, 164)';
            playerEyes.style.fill = playerEyes.style.fill || 'blue';
            playerFireball.style.backgroundColor = playerFireball.style.backgroundColor || '#ee4830';
        };
 
        window.writeForm = function () {
            inputColorCoat.value = playerCoat.style.fill;
            inputColorEyes.value = playerEyes.style.fill;
            inputColorFireball.value = playerFireball.style.backgroundColor;
        };
 
})();
// выбираем цвет нашего игрока
window.writeSetup();
Ответить с цитированием