Can I hide the text and button of my mean-menu jquery?

So basically I'm using a template for my site and adjusting accordingly. The site defines the menu-bar to be hidden on start and it appears on scroll down.

So basically I'm using a template for my site and adjusting accordingly. The site defines the menu-bar to be hidden on start and it appears on scroll down.

The text and menu button however, always appear on start. I cant understand how I can also tell the text (email and phonenumber) to stay hidden with the rest of the menu-bar.

    <header id="sticky-header" class="header-fixed">
        <div class="header-area">
            <div class="container sm-120">
                <div class="row">
                    <div class="col-md-9 col-sm-10" style="height: 70px; width: 930px">
                        <div class="col-md-4 col-sm-6">
                        <div class="logo text-upper">
                            <h6>xxxx / xxx 004 x8 / [email protected]</h6>
                        <div class="menu-area hidden-xs">
                            <div class="hamburger hamburger--collapse">
                                <div class="hamburger-box">
                                    <div class="hamburger-inner"></div>
                            <nav class="hamburger-menu">
                                <ul class="basic-menu clearfix">
                                    <li><a href="index.html">Home</a></li>
                                    <li><a href="index.html#about">About</a></li>
                                    <li><a href="index.html#portfolio">Portfolio</a></li>
                                    <li><a href="index.html#kontakt">Kontakt</a></li>
                                    <li><a href="impressum.html">Impressum</a></li>

3 JavaScript libraries to replace jQuery

3 JavaScript libraries to replace jQuery

Ubiquitous jQuery has been outmoded by JavaScript and browser advances. Cash, Zepto, and Syncfusion are three JavaScript libraries picking up where jQuery left off

Simplifying tasks such as HTML document traversal, animation, and event handling, the stalwart jQuery JavaScript library changed the face of web development. As of May 2019, **jQuery **is still being used in 74 percent of known websites, according to web technology surveyor W3Techs. Nevertheless, the jQuery library, which debuted in August 2006, is now being viewed by some developers as an older technology whose time has passed.

Alternatives to **jQuery **have emerged in recent years, such as the Cash library or even just modern, vanilla JavaScript, now that web browsers all handle **JavaScript libraries **the same way and jQuery is no longer needed to solve compatibility issues. Arguments on Reddit and videos on YouTube make the case that jQuery has become obsolete, or at least is not as essential as it once was.

Why jQuery is no longer needed

In one YouTube presentation, “Is jQuery still relevant in 2018?,” web development educator Brad Traversy acknowledges that jQuery is probably the best generalized JavaScript library ever created. It is easy to learn, cross-browser compatible, more concise than older vanilla JavaScript, and rich in plug-ins offering specific functionality. But JavaScript has advanced far since ECMAScript 6, and jQuery is no longer needed in many situations, Traversy concludes.

In another video, coding educator Kenneth Lowrey argues that becoming fluent in jQuery is a waste of time. In the current web development landscape, modern browsers handle JavaScript the same, for the most part. In most cases, native JavaScript code is better than a “bloated legacy library like jQuery,” he says.

While jQuery had been the choice for making HTTP requests, for example, ECMAScript 6 brought forth Fetch, a promised-based API that makes HTTP requests easier. And the advancement does not stop with HTTP. Where jQuery has utilities for tasks such as manipulating arrays, vanilla JavaScript now has improved accommodations for these operations, too.

Animations are still more difficult with vanilla JavaScript than jQuery, but there are other options such as CSS transitions or keyframes, Traversy points out. The third-party GreenSock library also can be used for animations. For DOM manipulation, a task once ruled by jQuery, native browser APIs have closed the gap.

For tasks that cannot be done in vanilla JavaScript, Traversy recommends specialized libraries, instead of a generalized library like jQuery. Traversy also recommends using JavaScript frameworks such as React, Angular, or Vue for mid-size and large applications. Traversy still recommends jQuery for use on simple sites with no framework.

jQuery alternatives

What should you use instead of jQuery? Besides modern, vanilla JavaScript, a short list of jQuery alternatives includes Cash, Zepto, and Syncfusion Essential JS 2. Cash and Zepto are open source JavaScript libraries available under an MIT license. Syncfusion Essential JS 2 is a commercial product.


Cash has more than 3,570 stars on GitHub. Billed as an “absurdly small jQuery alternative” for modern browsers, Cash has a jQuery-style syntax for manipulating the DOM and takes up 32KB of space, uncompressed. Cash supports capabilities including namespaced events, TypeScript types, and modern builds. You can download Cash from GitHub.


Zepto is described as “a minimalist **JavaScript library **with a largely jQuery-compatible API.” Developers who know jQuery already know how to use Zepto, its makers go on to say. Zepto purports to be much smaller and faster-loading than jQuery, and can work with the PhoneGap toolset for mobile and desktop browsers. You can download Zepto from the project website.

Syncfusion Essential JS 2

Syncfusion Essential JS 2 is a commercially licensed JavaScript UI controls library written in TypeScript. Serving as an alternative to the jQuery UI library, Syncfusion is designed to be a low-overhead, lightweight, and modular library to improve web applications. Syncfusion supports frameworks including Angular, React, and Vue. You can purchase Syncfusion Essential JS 2 or download a free trial from the Syncfusion website. Complete source code, unit test files, test scripts, and live demos are available on GitHub.

How to read XML in JavaScript using jQuery|Ajax

How to read XML in JavaScript using jQuery|Ajax

How to read XML in JavaScript using jQuery|Ajax- The jQuery JavaScript library is best known for its use working with HTML, but you can also use it to process XML. This article shows how to use jQuery to process a data store in XML format.

How to read XML in JavaScript using jQuery|Ajax- The jQuery JavaScript library is best known for its use working with HTML, but you can also use it to process XML. This article shows how to use jQuery to process a data store in XML format.

I’m going to share some tricks about XML file and APIs processing. I will also demonstrate how a web page can fetch information from an XML file in JavaScript using JQuery AJAX.

Assumptions: for the purpose of this article, I’m going to assume that you have good understanding and knowledge of JavaScript, the XML file format, and jQuery. If not please find documentation here to learn more details about it.

The project I worked on recently consisted of processing XML data resulting from an API call. The resulting **XML data **file was very large and its content is private data that I can’t share. *So in this post, I will show you how to process an ****XML demo ***file.

Below is the sample XML file from w3chools that I’ll be using for the demo:

<?xml version="1.0" encoding="UTF-8"?>

	       <name>Belgian Waffles</name> 
	       <description>Two of our famous Belgian Waffles with plenty of real maple syrup</description> 
	       <name>Strawberry Belgian Waffles</name> 
	       <description>Light Belgian waffles covered with strawberries and whipped cream</description> 
	       <name>Berry-Berry Belgian Waffles</name> 
	       <description>Light Belgian waffles covered with an assortment of fresh berries and whipped cream</description> 
	       <name>French Toast</name> 
	       <description>Thick slices made from our homemade sourdough bread</description> 
	       <name>Homestyle Breakfast</name> 
	       <description>Two eggs, bacon or sausage, toast, and our ever-popular hash browns</description> 

Now, create a folder for the demo project and save the demo.xml file in it. I named mine “XML-demo”. Inside your project folder, create a JavaScript file and HTML file that will display the data (index.html and main.js). I’m not using a separate CSS file for styling.

I recommend using Visual Studio Code IDE for this demo and in your VS Code install Live Server extension.
The following is a screenshot of my demo folder opened in VS code:

VS Code IDE Screenshot — shows files

Next step is adding your script and jquery-UI references in your index.html and define how you would like to display data. I’m simply displaying data in a “ul” element. Here’s how my index.html looks like:

<!DOCTYPE html>
	<html lang="en">

	        <meta charset="UTF-8">
	        <meta name="viewport" content="width=device-width, initial-scale=1.0">
	        <meta http-equiv="X-UA-Compatible" content="ie=edge">
	        <link rel="stylesheet" href="">

	        <!-- **************************************************************************************** 
	        !   connect your main.js script to hmtl                                                     *
	        !   add version of jquery                                                                   *
	        ! *************************************************************************************** -->
	        <script type="text/javascript" src="//"></script>
	        <script src=""></script>
	        <script src=""></script>

	        <!-- javascript reference -->
	        <script type="text/javascript" src="./main.js"></script>

	        <div class="container">
	            <div class="jumbotron" style="text-align: center;">
	                <h1 id="headerTitle">Food Menu List</h1>




	<!-- ****************************************** END **********************

Reading XML

So the basic method for doing asynchronous calls in jQuery is the AJAX() function, documented here. That documentation has a lot going on but that should get you started and help you walk through my main.js script to understand how the XML file is processed through AJAX:

// Do some stuff when page hmtl page is launched
	$(document).ready(function () {

	    // calling show food menu function
	    // If you want to fetch data from the file 
	    // call fetch data function instead of showFoodMenu
	    // fetchData()

	// ***************************************************************************************
	// this function calls showfoodmenu 3000 milisecond to get new changes                   *
	// made on demo.xml                                                                      *
	// ***************************************************************************************
	function fetchData() {
	    setTimeout(function () {
	        // recursive call
	    }, 3000);

	// **************************************************************************************
	// read data from demo.xml using Jquery | AJAX                                          *
	// **************************************************************************************
	function showFoodMenu() {

	        type: "GET",
	        url: "./demo.xml",
	        dataType: "xml",

	        error: function (e) {
	            alert("An error occurred while processing XML file");
	            console.log("XML reading Failed: ", e);

	        success: function (response) {

	            // make sure the ul is empty
	            // before appending data inot it

	            $(response).find("food").each(function () {
	                var _name = 'Name: ' + $(this).find('name').text();
	                var _price = 'Price: ' + $(this).find('price').text();
	                var _calories = 'Calories: ' + $(this).find('calories').text();
	                var _description = 'Description: ' + $(this).find('description').text();

	                // add content to the HTML          
	                $("ul").append('<li>' + _name + '</li>');
	                $("ul").append('<li>' + _price + '</li>');
	                $("ul").append('<li>' + _calories + '</li>');
	                $("ul").append('<li>' + _description + '</li>');

You should have the icon for Go live on your VScode IDE if you successfully install [***Live Server***]( "***Live Server***") extension. Clicked to Go Live icon on the right bottom of your VS code IDE or simply right click on HTML file and select “open with Live Server”. if you followed exactly and correctly what I did, you should get this:

Final result — Displaying XML data on HTML


Do not put the script reference to jquery-UI before the jquery script itself on your HTML otherwise you’ll get this error: ***Uncaught ReferenceError: $ is not defined. ***Make sure your script is referenced after you have referenced jquery-UI as I did in my main.js script.

Frequently used acronyms* API: Application programming interface

  • Ajax: Asynchronous JavaScript
  • CSS: Cascading Stylesheets
  • DOM: Document Object Model
  • HTML: Hypertext Markup Language
  • RSS: Really Simple Syndication
  • SGML: Standard Generalized Markup Language
  • SVG: Scalable Vector Graphics
  • URI: Uniform Resource Identifier
  • URL: Uniform Resource Locator
  • W3C: World Wide Web Consortium
  • XHTML: Extensible Hypertext Markup Language

If you enjoyed this story, you might also like “How to Set Up the Development Environment

How to set up face verification the easy way using HTML5 + JavaScript

How to set up face verification the easy way using HTML5 + JavaScript

<strong>Originally published by </strong><a href="" target="_blank">Matthew Enubuje</a><strong> </strong><em>at&nbsp;</em><a href="" target="_blank"><em>Medium</em></a>

I’ve created a very simple way to face match two images using HTML5 and JavaScript. You upload the verification picture you’d like to use, take a snapshot from the video streaming from your camera/webcam, then use a face matching API to retrieve the results. Simple.

The Github Repo

What You’ll Need:

  • A Webcam/Camera
  • Free Face Recognition API Key
  • Web Server

Before We Begin

Create a Directory For This Project

This directory will be where we put all the files.

Create a Local Web Server

In order to have full control of images, a web server is required otherwise we’d be getting a tainted canvas security error. There are several ways to do this and I’ve listed below how to do it with Python.


cd C:/DIRECTORY_LOCATION & py -m http.server 8000

You should be able to access the directory through http://localhost:8000

Get Your Free API Key

We’re going to be using Facesoft’s face recognition API. Quickly sign up here to access your free API key so you can get unlimited API calls with up to two requests per minute.

Once you’ve logged in, your API key will be visible in the dashboard area.

1. Setup

Create these three files:

  • index.html
  • style.css
  • verify.js

Next right click and save the files below into that directory. These image files will be the default images for uploaded and verification pics.

SAVE AS “defaultupload.png”

SAVE AS “defaultphoto.png”

2. The HTML


Copy and paste the layout code below into your “index.html” file. This gives us our framework and design with the help of bootstrap.

<!DOCTYPE html>
<html lang="en">
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
  <link rel="stylesheet" href="" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- Style CSS -->
  <link rel="stylesheet" href="style.css">
<title>Face Verification</title>
  <!-- Page Content -->
  <div class="container">
    <div class="row">
      <div class="col-lg-12 text-center">
        <h1 class="mt-5">Face Verification</h1>
        <p class="lead">Quick and simple face verification using HTML5 and JavaScript</p>
<!-- Verify JS -->
 <script src="verify.js"></script>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
  <script src="" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  <script src="" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
  <script src="" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

Images, Canvases & Buttons

We’re now creating a row and having three columns for the verification photo, the video stream, and the photo taken from the video stream. Add the code below right after the row.

Check for “INSERT NEXT CODE HERE” tag in previous code.

<div class="row justify-content-md-center">
  <div class="col-lg-4 text-center">
    <p><strong>Verification Photo</strong></p>
      <!-- Canvas For Uploaded Image -->
      <canvas id="uploadCanvas" width="300"  height="300"></canvas>
      <!-- Default Canvas Image -->
      <img src="defaultupload.png" id="uploadedPhoto" alt="upload"/>
      <!-- Upload Image Input & Upload Photo Button -->
      <input type="file" name="image-upload" accept="image/png, image/jpeg">
      <button id="upload" type="button" class="btn btn-outline-primary btn-lg">Upload Photo</button>
  <div class="col-lg-4 text-center">
    <!-- Camera -->
    <div class="camera-container">
      <video id="video" width="100%" height="300" autoplay="true">
    <!-- Take Photo Button -->
    <button id="capture" type="button" class="btn btn-outline-primary btn-lg">Take Photo</button>
  <div class="col-lg-4 text-center">
    <p><strong>Photo Taken</strong></p>
    <!-- Canvas For Capture Taken -->
    <canvas id="captureCanvas" width="300"  height="300"></canvas>
    <!-- Default Canvas Image -->
    <img src="defaultphoto.png" id="capturedPhoto" alt="capture" />
    <!-- Verify Photos Button -->
    <button id="verify" type="button" class="btn btn-outline-success btn-lg">Verify Photo</button>

API Response and Warnings

The code we’re going to add is to display the match result, score percentage, errors and warnings. Right under the last code we added, add the code below.

<div class="row">
  <div class="col-lg-12 text-center">
    <!-- API Match Result & API Percentage Score -->
    <h2 id="match" class="mt-5"></h2>
    <p id="score" class="lead"></p>
  <div class="col-lg-12 text-center">
    <!-- Error & Warning Alerts -->
    <div class="alert alert-danger" id="errorAlert"></div>
    <div class="alert alert-warning" id="warningAlert"></div>

3. The CSS

Add the code below to your style.css file.

.camera-container {
  max-width: 100%;
  border: 1px solid black;
.verification-image {
  width: 300px;
  height: auto;
  max-width: 100%;
.btn {
  margin-top: 10px;
#captureCanvas, #uploadCanvas {
  display: none;
input[name="image-upload"] {
  display: none;
#errorAlert, #warningAlert {
  display: none;

We’ve set the image upload input to display none as we’ll be triggering it using the upload button. Also, the IDs for the canvases have been set to display none so the default images are initially displayed.

Here is what your screen should look like:

4. The JavaScript

document.addEventListener("DOMContentLoaded", function() {

In the verify.js file we want to start off by adding an event listener that will run after the page loads. Every code we enter should be inside this function.


var video = document.getElementById('video'), 
captureCanvas = document.getElementById('captureCanvas'), 
uploadCanvas = document.getElementById('uploadCanvas'), 
captureContext = captureCanvas.getContext('2d'),
uploadContext = uploadCanvas.getContext('2d'),
uploadedPhoto = document.getElementById('uploadedPhoto'),
capturedPhoto = document.getElementById('capturedPhoto'),
imageUploadInput = document.querySelector('[name="image-upload"]'),
errorAlert = document.getElementById('errorAlert'), AlertwarningAlert = document.getElementById('warningAlert'),
matchText = document.getElementById('match'),
scoreText = document.getElementById('score');

The variables are:

  • IDs for the video element, canvases, photos & API response
  • Selector for image input
  • Canvas contexts
  • API key

Video Stream

Here is a very simple code to access your webcam/camera and stream it into the video element. Add underneath variables.

// Stream Camera To Video Element
  navigator.mediaDevices.getUserMedia({ video: true })
  .then(function(stream) {
    video.srcObject = stream;
  }).catch(function(error) {

If you refresh your page, this is what you’ll see:


Function 1: Set Photo To Canvas

// Set Photo To Canvas Function
function setImageToCanvas(image, id, canvas, context, width=image.width, height=image.height) {
  var ratio = width / height;
  var newWidth = canvas.width;
  var newHeight = newWidth / ratio;
  if (newHeight > canvas.height) {
    newHeight = canvas.height;
    newWidth = newHeight * ratio;
  context.clearRect(0, 0, canvas.width, canvas.height);
  context.drawImage(image, 0, 0, newWidth, newHeight);
  id.setAttribute('src', canvas.toDataURL('image/png'));

In this function, we take in the image, id, canvas, context, width and height. We take in the width and height because to get the dimensions of the video, we must use video.videoWidth & video.videoHeight.

We also get the aspect ratio of the image so that when we assign an image, it fits right into the canvas. The rest of the code clears the canvas and draws the new image into the canvas.

Function 2: Verify If The Photos Match By Sending Them To The API.

// Facesoft Face Match API Function
function verifyImages(image1, image2, callback){
  var params = {
    image1: image1,
    image2: image2,
  var xhr = new XMLHttpRequest();"POST", "");
  xhr.setRequestHeader("apikey", apiKey);
  xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
  xhr.onload = function(){

In this function we make an XMLHttpRequest to the face match API endpoint. We’ve added the API key for authorisation and content type into the header. For the body we’re passing in an object containing the two images.

Now we’re done with functions :)

Upload Photo Button Click Event

// On Upload Photo Button Click
document.getElementById('upload').addEventListener('click', function(){;

This click event listener for the upload button triggers a click for the image input.

Image Upload Input Change Event

// On Uploaded Photo Change
imageUploadInput.addEventListener('change', function(){
  // Get File Extension
  var ext = imageUploadInput.files[0]['name'].substring(imageUploadInput.files[0]['name'].lastIndexOf('.') + 1).toLowerCase();
  // If File Exists & Image
  if (imageUploadInput.files && imageUploadInput.files[0] && (ext == "png" || ext == "jpeg" || ext == "jpg")) {
    // Set Photo To Canvas
    var reader = new FileReader();
    reader.onload = function (e) {
      var img = new Image();
      img.src =;
      img.onload = function() {
      setImageToCanvas(img, uploadedPhoto, uploadCanvas, uploadContext);

In this change event listener, we retrieve the file extension and perform an if statement to check if there is an image file in the input. Then we use FileReader to load the image onto the canvas.

Take Photo Button Click Event

// On Take Photo Button Click
document.getElementById('capture').addEventListener('click', function(){
  setImageToCanvas(video, capturedPhoto, captureCanvas, captureContext, video.videoWidth, video.videoHeight);

This event listener now executes the set image to canvas to capture a still frame from the video and assign it into a canvas.

Verify Photo Button Click Event

// On Verify Photo Button Click
document.getElementById('verify').addEventListener('click', function(){
  // Remove Results & Alerts = "none"; = "none";
  matchText.innerHTML = "";
  scoreText.innerHTML = "";
  // Get Base64
  var image1 = captureCanvas.toDataURL().split(',')[1];
  var image2 = uploadCanvas.toDataURL().split(',')[1]; 
  // Verify if images are of the same person
  verifyImages(image1, image2, function(response){
      var obj = JSON.parse(response);
      // If Warning Message
      if(obj.message){ = "none"; = "block";
        warningAlert.innerHTML = obj.message;
        matchText.innerHTML = "";
        scoreText.innerHTML = "";
      // If Error
      else if(obj.error){ = "block";
        errorAlert.innerHTML = obj.error; = "none";
        matchText.innerHTML = "";
        scoreText.innerHTML = "";
      // If Valid
      else{ = "none"; = "none";
        matchText.innerHTML = obj.match;
        scoreText.innerHTML = (obj.score*100).toFixed(2)+"% Score";

In this event, we first hide the error/warning alerts and remove any text from the match result and score percentage.

We then get the base64 of the images from the canvases and use the split method to only get the part without “ data:image/png;base64” so the API won’t return an error.

Lastly, we call the verify images function to send the data to the API and our response will be an object either containing the results, an error, or a message.

Final Code

// Set Default Images For Uploaded & Captured Photo
setImageToCanvas(uploadedPhoto, uploadedPhoto, uploadCanvas, uploadContext);
setImageToCanvas(capturedPhoto, capturedPhoto, captureCanvas, captureContext);

This will allow us to verify the default images by assigning them to their canvas.

5. The Rock vs Dwayne Johnson

If you click verify we shall now see if the API can tell the difference between The Rock at a young age and Dwayne Johnson we usually see in films…

The API correctly identifies the 2 as the same with a 96.53% match score!

Upload, Capture, Verify

In Closing

You should now be able to think of better, secure and more complex ways to implement face matching such as logging in, 2FA, authorisation, payments etc.

Accuracy & Reliability?

The results for the best face recognition algorithm in the world came out. The algorithm we’re using came in the top 10 beating Toshiba, Microsoft & VisionLabs, and came 2nd worldwide in the wild image test (detection at difficult angles).