Перейти к содержимому
Главная
Прикладная информатика
Учебные задания
Web-программирование
HTML
JS
PHP
Новости
Меню навигации
Меню навигации
Главная
Прикладная информатика
Учебные задания
Web-программирование
HTML
JS
PHP
Новости
Выберите цвет
Red
Orange
Green
Blue
Violet
Выберите форму
Circle
Square
Ellipse
Rectangle
jQuery(document).ready(function($) { let currentColor = 'red'; let currentShape = 'circle'; $(".controlColor").find(":button").click(function() { currentColor = $(this).attr('id'); $('#shape').css('background-color', currentColor); }); $('#circleBtn').click(function() { $('#shape').css({ 'border-radius': '50%', 'width': '100px', 'height': '100px' }); }); $('#squareBtn').click(function() { $('#shape').css({ 'border-radius': '0', 'width': '100px', 'height': '100px' }); }); $('#rectangleBtn').click(function() { $('#shape').css({ 'border-radius': '0', 'width': '200px', 'height': '100px' }); }); $('#ellipseBtn').click(function() { $('#shape').css({ 'border-radius': '50px', 'width': '200px', 'height': '100px' }); }); });
#Colors button { background-color: black; color: white; border-radius: 5px; font-size: 16px; padding: 8px; } #Shapes button { font-size: 16px; border-radius: 5px; color: white; background-color: black; padding: 8px; } #shape { height: 40px; width: 40px; background-color: red; border-radius: 50%; margin: 20px; transition: all 0.3s; } .square { width: 50px; height: 50px; border-radius: 0; } .circle { border-radius: 50%; } .rectangle { width: 100px; height: 50px; border-radius: 0; } .ellipse { border-radius: 25px; width: 100px; height: 50px; }
Results:
Выберите цвет
Red
Orange
Green
Blue
Violet
Выберите форму
Circle
Square
Ellipse
Rectangle