UNPKG

javascript-mobile-app-template

Version:

Simple and fully customizable user interface template. Design for mobile app development on Capacitor or Cordova. Platforms: Android, iOS, Web.

88 lines (65 loc) 2.8 kB
<!DOCTYPE html> <html> <head> <title>UI Search Box</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 src="components/ui-core.js" type="text/javascript" charset="utf-8"></script> <script src="components/ui-search-box.js" type="text/javascript" charset="utf-8"></script> <style> .search-box::-webkit-input-placeholder { color: rgba(0, 0, 0, 0.4); } </style> <script> var box1, box2; var uiSearchBox1, uiSearchBox2; window.onload = function() { // BOX: Container for uiSearchBox1 box1 = createBox(0, 0, getDefaultContainerBox().width, getDefaultContainerBox().height / 2); that.color = "#5ABB9F"; // BOX: Container for uiSearchBox2 box2 = createBox(0, 0, box1.width, box1.height); that.color = "white"; that.top = box1.height; // EXAMPLE 1 // UI SEARCH BOX 1: uiSearchBox1 = UISearchBox.create({ width: 300, height: 50, searchIconFile: "components/ui-search-box/search.svg", clearIconFile: "components/ui-search-box/clear.svg", color: "rgba(0, 0, 0, 0.2)", textColor: "rgba(0, 0, 0, 0.65)", borderBottomStyle: "2px solid rgba(0, 0, 0, 0.2)", }); box1.add(that); uiSearchBox1.txtSearch.inputElement.classList.add('search-box'); uiSearchBox1.center(); uiSearchBox1.onSearch(function searched(searchText, uiSearchBox) { console.log("uiSearchBox1 text: " + searchText); }); // EXAMPLE 2 // UI SEARCH BOX 2: uiSearchBox2 = UISearchBox.create({ width: 300, height: 50, searchIconFile: "components/ui-search-box/filter.png", isCancelEnabled: 0, placeholderText: "Filter", }); box2.add(that); that.center(); uiSearchBox2.onSearch(function searched(searchText, uiSearchBox) { console.log("uiSearchBox2 text: " + searchText); }); } </script> </head> <body> <!-- HTML content --> </body> </html>