A package to toggle properties of your HTML tags.

Overview

Toggler

Toggler

A package(atleast the code) to toggle properties of tags.

I mostly use toggle classes while making a switch theme method, button interaction etc.

New feature:

Toggle images too:

  • Now toggle images with an ease.
  • No more InteractionCount().

Syntax:

const toggler = new Toggler;
toggler.toggleImage('elementID', 'fromImage', 'toImage');
  • Create a new object using const toggler = new Toggler.

Toggle slides:

  • You can now toggle slides(an element).
  • You can select upto 2 types of slide one is vertical side and horizontal slide.
  • Vertical toggle is coded and can be used.

Syntax:

const toggler = new Toggler;
toggler.toggleSlide('elementID', 'direction', speed);

Direction:

  • Direction says about in what direction the slide to start either horizontal slide or vertical slide. (visit docs for more info link is below.)

Speed:

  • Speed defines the speed of the toggling that mean how fast it should slide.

Example:

const toggler = new Toggler;
toggler.toggleSlide('testElement', 'horizontal', 60);//toggles the slide horizontally i.e from left to right or right to left
toggler.toggleSlide('testElement2', 'vertical', 60);//toggles the slide vertical i.e from bottom to top or top to bottom

Note: To avoid problems use left:30px or top:30px instead of margin-left:30px or margin-top:30px because the code calculats the offset values.

Future planned improvements:

  • Add a toggleProperty() to toggle between properties of the elements or tags.
  • Optimise code.
  • Release a CDN.
  • Make the code more stable.
  • Improve toggleSlide() for vertical toggles.

Optimizations:

  • Now Toggler is a class.
  • Removed InteractionCount() which sometimes doesn't work properly.
  • Added vertical slide support.

How to download:

Downloading:

  • Click on the code dropdown and click 'Download zip' to download.

Cloning using cmd(only for contribution purpose)

  • To clone the repo click on the code dropdown and there you can copy the link.
  • Then open cmd in your pc and type
$ git clone url
  • Replace 'url' with the copied link and click enter.
  • Repository will be cloned and you can use Toggler.js in your code.
  • If you want to contribute changes can be pushed(check the code before pushing to origin or push to 'other' branch).

Or else:

  • Just copy paste the code.

Note: While using Toggler.js please make sure you have a backup because if something goes wrong and you pushed the changes then things will become tedious to handle.

How to use:

  • You can clone the project or just download the Toggler.js. (Will release a npm package later)
  • include this script before including your main script.

for example:

<script src = "Toggler.js"></script>
<script src = "myscript.js"></script>
  • After this you can use toggler.toggleClass(elementId, fromClass, toClass) method to toggle between classes toggler.toggleImage(elementID, fromImage, toImage) to toggle between images in your main script.

Syntax:

In HTML file:

<head>
    <script src = "Toggler.js"></script>
    <script src = "myscript.js"></script>
</head>
  • You can use these in <body></body> too.

Your main JavaScript file:

 const toggler = new Toggler;
 toggler.toggleClass('elementID', 'fromClass', 'toClass');

For example:

 const toggler = new Toggler;
 toggler.toggleClass('elementID', 'fromClass', 'toClass');
 toggler.toggleImage('elementID', 'fromImage', 'toImage');
 toggler.toggleSlide('elementID', 'direction', speed)

elementID:

ID of the element to which you want to change the class.

fromClass:

element's current class name.

toClass:

New class name to the given element.

Direction:

  • Direction says about in what direction the slide to start either horizontal slide or vertical slide. (visit docs for more info link is below.)

Speed:

  • Speed defines the speed of the toggling that mean how fast it to slide.

  • Note that speed is int literal.

Note: Remember all the arguments are strings except speed.

Remember to use this syntax in your main script not in Toggler.js

Note: Don't try to manipulate the Toggler.js unless you know javascript.

For more info about the 'Toggler' visit Toggler Docs.

Contribution:

  • You can contribute to this repo by creating a pull request for features and issue for bug reports

license:

  • This repository is licensed under MIT.

Contact us:

You might also like...

Download Notion pages as markdown and image files, preserving hierarchy and enabling workflow properties. Works with Docusaurus.

Download Notion pages as markdown and image files, preserving hierarchy and enabling workflow properties. Works with Docusaurus.

notion-pull notion-pull lets you use Notion as your editor for markdown-based static site generators like Docusaurus. Using Notion instead of raw mark

Jan 7, 2023

🧩 TypeScript utility type in order to ensure to return only properties (not methods) containing values in primitive types such as number or boolean (not Value Objects)

🧩 TypeScript utility type in order to ensure to return only properties (not methods) containing values in primitive types such as number or boolean (not Value Objects)

🧩 TypeScript Primitives type TypeScript utility type in order to ensure to return only properties (not methods) containing values in primitive types

Dec 7, 2022

A complete media query framework for CSS, to apply specific properties in specific screen

A complete media query framework for CSS, to apply specific properties in specific screen

A complete media query framework for CSS, to apply specific properties in specific screen Note: Size of every media query is `50px, 100px, 150px, 200p

Aug 23, 2022

Extract CSS custom properties and a JavaScript config from Drupal's theme breakpoints

Extract CSS custom properties and a JavaScript config from Drupal's theme breakpoints

Drupal breakpoints to CSS To eliminate the need for different places for breakpoints and only maintain a single source of truth for those, this node_m

Nov 21, 2022

A Zotero add-on that scans your Markdown reading notes, tags the associated Zotero items, and lets you open notes for the Zotero items in Obsidian.

A Zotero add-on that scans your Markdown reading notes, tags the associated Zotero items, and lets you open notes for the Zotero items in Obsidian.

Zotero Obsidian Citations Adds colored tags to Zotero items that have associated Markdown notes stored in an external folder. Open an associated Markd

Jan 4, 2023

Interactive, accessible toggle switches for the web.

On-Off Toggle Switch Interactive, accessible toggle switches for the web Transform checkboxes into toggle switches. Toggle switches made for the web a

Sep 9, 2022

DoMe is a ToDo App. you can add, delete and reorder elements of the todo list using drag and drop. You can also toggle between dark&light mode

DO ME Todo App Live Preview : DO ME Built With : - ReactJS - TailwindCSS Make sure you have: - Git - Nodejs version 14 or higher (we recommend using

Nov 18, 2022

Toggle Dark-Mode manually on InStream.de

InStream.de Dark-Mode Umschalter Was es macht Dieses Add-On für Firefox fügt einen Button hinzu, mit dem man websites zwischen "Normal" und "Dark-Mode

Feb 7, 2022

❤️ A heart-shaped toggle switch component for React.

❤️ A heart-shaped toggle switch component for React.

heart-switch A heart-shaped toggle switch component for React. Inspired by Tore Bernhoft's I heart toggle Dribbble shot. 📖 Table of Contents 🚀 Getti

Dec 15, 2022
Releases(v0.4.6)
Owner
chandra sekhar pilla
An E.C.E student. And an astrophile Learning coding, game development and 3d modelling. Interested in creating something new.
chandra sekhar pilla
In this project, I built a to-do list app, which is inspired by the minimalist website. Build withHTML/CSS & JavaScript best practices: Correct use of tags, elements, properties and syntax.

Webpack Exercise In this project, I built a to-do list app, which is inspired by the minimalist website. Built With HTML/CSS & JavaScript best practic

Vanessa Oliveros 3 Oct 11, 2022
An Awesome Toggle Menu created with HTML,CSS,JQuery,font-awesome and line by line comment.

Demo : https://blackx-732.github.io/AwesomeMenu/ Under open source license No ©copyright issues Anyone can be modify this code as well Specifically we

BlackX-Lolipop 2 Feb 9, 2021
Kuldeep 2 Jun 21, 2022
A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time.

A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time. Dropdown, navigation bu

Matthieu Bué 277 Nov 25, 2022
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
A ideia do projeto era desenvolver um jogo onde o usuário pode tentar "descobrir" ou melhor dizendo, lembrar a maior quantidade de HTML Tags em um determinado tempo.

HTML Tag Memory Test ?? Tecnologias Esse projeto foi desenvolvido com as seguintes tecnologias: ViteJS ReactJS Typescript Tailwind Zustand Immer Axios

Igor Santos 4 May 17, 2022
Linkify is a JavaScript plugin for finding links in plain-text and converting them to HTML tags.

Linkify Linkify is a JavaScript plugin. Use Linkify to find links in plain-text and convert them to HTML <a> tags. It automatically highlights URLs, #

Hypercontext 1.5k Dec 27, 2022
Math Calc is a simple algebra calculator with options for basic addition, subtraction, multiplication, and division as well as many more mathematical properties.

Math-Calc Math Calc is a simple algebra calculator with options for basic addition, subtraction, multiplication, and division as well as many more mat

CoderX07 1 Dec 25, 2021
A simple element template chooser for properties-panel >= 1

A simple element template chooser for properties-panel >= 1

bpmn.io 9 May 30, 2022
This simple extension can automatically load NBN availability information for properties on realestate.com.au & domain.com.au including technology type, maximum line speed, and co-existance status if available.

NBN Availability Check Chrome Extension This simple extension can automatically load NBN availability information for properties on realestate.com.au

Luke Prior 17 Aug 17, 2022