New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

floating-window

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

floating-window

JavaScript module which creates a floating window. The window consists of a header, a titlel and a close button. In addition to closing, event handlers to move the window are added. The actual content of the window is then passed when the class is ini

  • 0.1.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

floating-window

JavaScript module which creates a floating window. The window consists of a header, a titlel and a close button. In addition to closing, event handlers to move the window are added. The actual content of the window is then passed when the class is initialized.

The Modul has a default export for the class "win". You'll find an example in "demo".

How to use

install

npm install floating-window

import

import Win from './node_modules/floating-win/index.js'

create instance

Inits the class and creates the window. But the window is not added to any tree.

const winId = 'myFloatingTestWin';  // the id for the new window
const winTitle = 'Test title';      // the text that is displayed in the title bar of the window
const winBody = document.createElement('div');
// ... body building
const winFloat = new Win(winId, winTitle, winBody);

append the window

Append the window to a tree. This can be also a shadow tree.

winFloat.appendWindow(document.documentElement);

show the window

Append the window to a tree. This can be also a shadow tree.

winFloat.show();

hide the window

The window can either close by the close button in the window head. Or you use the "hide" method:

winFloat.hide();

destroy the window

To destroy the window and remove all EventListener call the "destroy" method.

winFloat.destory();

styling

The following selectors are available:

  • floating-win (for the dialog)
  • floating-win-head (for the head of the window)
  • floating-win-head-title (for the title inside the head)
  • floating-win-head-closer (for the element represents the close button)
  • floating-win-body (parent element for the content of the window)

If the window is inserted into the shadow DOM, then the selector must be used as a parameter for "::part".

::part(floating-win-head) {
    background-color: darkblue;
}

Keywords

FAQs

Package last updated on 04 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc