Highlight a DOM Element on Hover Like Web Inspectors | theroomjs

TheRoom is a Vanilla JavaScript plugin that allows you to define dom elements such as web inspectors.

Theroomjs can be accessed globally as theRoom. It is compatible with modern browsers like Google Chrome, Mozilla Firefox, Safari, Edge, and Internet Explorer.

How to make use of it:

Download and import the ‘theroom.js’ into the doc.

<script src="dist/theroom.min.js"></script>

Initialize the TheRoom and finished.

theRoom.start();

To create an info bar that shows the present HTML tag, and CSS ID/class.

var template="";
    template += "<div id=\"theroom-info\">";
    template += "  <span id=\"theroom-tag\"><\/span>";
    template += "  <span id=\"theroom-id\"><\/span>";
    template += "  <span id=\"theroom-class\"><\/span>";
    template += "<\/div>";
    template += "";
    template += "<style>";
    template += "  #theroom-info {";
    template += "    position: fixed;";
    template += "    bottom: 0;";
    template += "    width: 100%;";
    template += "    left: 0;";
    template += "    font-family: \"Courier\";";
    template += "    background-color: #ffffff;";
    template += "    padding: 10px;";
    template += "    color: #333333;";
    template += "    text-align: center;";
    template += "    box-shadow: 0px 4px 20px rgba(0,0,0,0.3);";
    template += "  }";
    template += "";
    template += "  #theroom-tag {";
    template += "    color: #C2185B;";
    template += "  }";
    template += "";
    template += "  #theroom-id {";
    template += "    color: #5D4037;";
    template += "  }";
    template += "";
    template += "  #theroom-class {";
    template += "    color: #607D8B;";
    template += "  }";
    template += "<\/style>";

var options = {
  template: template,
  showInfo: true
};

// initialize
theRoom.start(options);

More plugin choices with default values.

var options = {

    // namespace
    namespace: "theroom",

    // background color of the overlay
    bgcolor: "rgba(255,0,0,0.5)",

    // transition speed in milliseconds
    transitionSpeed: 200,

    // uses inline style attribute instead style
    useInline: true,

    // exclude these tags
    exceptions: [
      "head",
      "meta",
      "link",
      "style",
      "title",
      "script"
    ]
    
}

Callback features are out there.

var options = {

    onStart: null,
    onStarting: null,
    onStop: null,
    onStopping: null,
    onClick: null,    
}

Highlight DOM Elements On Hover, javascript highlight element, mouseover event target, animate css3, theroomjs Plugin/Github

Highlight-a-DOM-Element-on-Hover-Demo


See Demo And Download

Official Website(hsynlms): Click Here

This superior jQuery/javascript plugin is developed by hsynlms. For extra Advanced usage, please go to the official website.

Related Posts

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Bootstrap-4-Sidebar-Menu-Responsive-Template

Bootstrap 4 Sidebar Menu Responsive Template | MDB

Bootstrap Side Navbar – Responsive sidebar template based on the Bootstrap 4 framework. An easy-to-use, totally responsive, Google Material Design impressed aspect navigation for modern web app…

Bootstrap-4-Toast-Notification-Plugin

Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Audio-Visualizations-Wave

How to Create Audio Visualizations with JavaScript | Wave.js

Audio Visualizer Library – wave.js is a vanilla javascript audio visualization library that provides 20+ creative audio visualization effects to bring more engagement to your visitor. Contribute…

bootstrap-5-treeview

Bootstrap 5 Treeview Dynamically Collapsible | bs5treeview

Bootstrap 5 Tree View is a very simple plug-in for creating a basic and elegant Treeview using BS5. For use with Bootstrap 5, the attributes have been…

Leave a Reply

Your email address will not be published. Required fields are marked *