UNPKG

basic-ui-js

Version:

A lightweight JavaScript library for building web-based applications with simple code. No need to write HTML or CSS — just use basic JavaScript.

61 lines (44 loc) 1.58 kB
<!DOCTYPE html> <html> <head> <title>Box Example</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <!-- LIBRARY FILES --> <link rel="stylesheet" type="text/css" href="basic/basic.min.css"> <script src="basic/basic.min.js" type="text/javascript" charset="utf-8"></script> <script> let box; window.onload = function() { // BOX: My box. box = Box({ right: 0, bottom: 0, width: "100%", height: 200, color: "orangered", }); that.clickedCount = 0; that.on("click", function(event) { increaseCount(box); }); // LABEL: Box name text. box.lblName = Label({ top: 20, left: 20, text: "Click Me", textColor: "rgba(0, 0, 0, 0.7)", }); box.add(that); }; const increaseCount = function(clickedBox) { clickedBox.clickedCount++; clickedBox.lblName.text = "Box Clicked: " + clickedBox.clickedCount; clickedBox.bottom = clickedBox.clickedCount; }; </script> </head> <body> <!-- HTML content --> </body> </html>