Es5 getting started in EJ2 JavaScript AppBar
24 Nov 20262 minutes to read
The Essential® JS 2 for JavaScript (global script) is an ES5 formatted pure JavaScript framework which can be directly used in latest web browsers.
Dependencies
The following list of dependencies are required to use the AppBar control in your application.
|-- @syncfusion/ej2-navigations
|-- @syncfusion/ej2-baseCreate a Folder and HTML File
-
Create a folder named
quickstartin your desired directory. -
Inside the
quickstartfolder, create a new file namedindex.html.
Control Initialization
The Essential® JS 2 JavaScript controls can be initialized by using below css styles and scripts
Add Syncfusion® AppBar CSS Styles and Scripts
Include the following CSS and JavaScript files from CDN in the <head> section of the index.html file. The ej2-base, ej2-buttons script is the required dependency package for the AppBar component.
Styles(CSS):
https://unpkg.com/@syncfusion/ej2-bootstrap5.3-theme/styles/appbar/index.cssScripts (javascript):
https://cdn.syncfusion.com/ej2/35.1.37/ej2-base/dist/global/ej2-base.min.js
https://cdn.syncfusion.com/ej2/35.1.37/ej2-buttons/dist/global/ej2-buttons.min.js
https://cdn.syncfusion.com/ej2/35.1.37/ej2-navigations/dist/global/ej2-navigations.min.jsAdding AppBar component to the application
Add the AppBar element and initiate the Syncfusion® JavaScript AppBar control in the index.html by using following code.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Essential JS 2 - AppBar</title>
<!-- Essential JS 2 AppBar's dependent bootstrap5.3 theme -->
<link href="https://unpkg.com/@syncfusion/ej2-bootstrap5.3-theme/styles/appbar/index.css" rel="stylesheet" />
<!-- Essential JS 2 AppBar's dependent scripts -->
<script src="https://cdn.syncfusion.com/ej2/35.2.12/ej2-base/dist/global/ej2-base.min.js" type="text/javascript"></script>
<!-- Essential JS 2 AppBar's global script -->
<script src="https://cdn.syncfusion.com/ej2/35.2.12/ej2-navigations/dist/global/ej2-navigations.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/35.2.12/ej2-buttons/dist/global/ej2-buttons.min.js" type="text/javascript"></script>
</head>
<body>
<!--element which is going to render-->
<div class="control-container">
<header id="appbar">
<button id="defaultButtonMenu"></button>
<span class="regular" style="margin:0 5px">EJ2 AppBar</span>
<div class="e-appbar-spacer"></div>
<button id="defaultButtonLogin"></button>
</header>
</div>
<script>
var appbarObj = new ej.navigations.AppBar({
colorMode: 'Primary'
});
appbarObj.appendTo("#appbar");
var defaultButtonMenuObj = new ej.buttons.Button({ cssClass: 'e-inherit', iconCss: 'e-icons e-menu' });
defaultButtonMenuObj.appendTo('#defaultButtonMenu');
var defaultButtonLoginObj = new ej.buttons.Button({ cssClass: 'e-inherit', content: 'FREE TRIAL' });
defaultButtonLoginObj.appendTo('#defaultButtonLogin');
</script>
</body>
</html>