Giter Site home page Giter Site logo

bramverb / html5-knob Goto Github PK

View Code? Open in Web Editor NEW

This project forked from denilsonsa/html5-knob

0.0 0.0 2.0 798 KB

A rotary web input component

Home Page: http://denilsonsa.github.io/html5-knob/

License: The Unlicense

HTML 77.83% CSS 0.43% JavaScript 21.75%

html5-knob's Introduction

<x-knob> Web Component

<x-knob> is a rotary web input component that can be controlled by dragging and rotating it (with the mouse pointer or touch input).

Open the demo page!

Short demonstration GIF

This component has been created as a proof-of-concept, as a simple base that can be improved upon. It is a more polished version of a previous experiment.

Features:

How to use

Open the demo page and its source-code. Study the demo to understand what this component is capable of.

Is it not enough? Dive into xknob.js and feel free to study how it works, and feel free to modify it to suit your needs. This repository is less like a fully packaged library and more like a starting point to let other people develop more stuff. Be sure to read HTML5 Rocks tutorial on custom elements.

Limitations (AKA known bugs)

The current implementation is not very accessible. It would be great to apply ARIA guidelines.

The current implementation does not support DOM0-style events (e.g. xknob.oninput = function(){} will not work). Using the modern xknob.addEventListener('input') works fine.

This control is not considered a form-associated element, thus its value does not get submitted. A partial solution would be to add <input type="hidden"> as a direct children of <x-knob>; however, I don't know how trigger an update of XKnob whenever the <input type="hidden"> element gets updated (i.e. how to make form.input_name.value = 1 also update XKnob?).

The current implementation lets the element to be focused (by tab-navigation or by clicking) even if it is disabled.

Pseudo-classes such as :disabled do not work on this custom element. Maybe someday? is it even possible to implement that? (Note: :focus already works.)

For some reason, using two fingers to zoom the page will not work if one of the fingers starts the touch on the knob.

Acknowledgements

This code is loosely inspired by KaisarCode Rotate.

The usage of HTML5 custom elements is based on HTML5 Rocks tutorial, found through W3C Wiki.

Mozilla Developer Network proved to be an extremely valuable resource.

Web Components the Right Way is a very comprehensive list of resources related to Web Components.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.