Галерея 3096470
⚡ ПОДРОБНЕЕ ЖМИТЕ ЗДЕСЬ 👈🏻👈🏻👈🏻
Галерея 3096470
Sign up or log in to customize your list.
more stack exchange communities
company blog
Stack Overflow for Teams
– Start collaborating and sharing organizational knowledge.
Create a free Team
Why Teams?
Asked
12 years, 8 months ago
Modified
1 year, 8 months ago
28.6k 25 25 gold badges 97 97 silver badges 157 157 bronze badges
Sorted by:
Reset to default
Highest score (default)
Trending (recent votes count more)
Date modified (newest first)
Date created (oldest first)
6,344 5 5 gold badges 32 32 silver badges 36 36 bronze badges
13.9k 7 7 gold badges 78 78 silver badges 72 72 bronze badges
68k 30 30 gold badges 171 171 silver badges 212 212 bronze badges
2,178 15 15 silver badges 19 19 bronze badges
4,876 24 24 silver badges 24 24 bronze badges
625 7 7 silver badges 11 11 bronze badges
//init
let r = document.getElementById('r'),
p = document.getElementById('p'),
signaturePath = '',
isDown = false,
svg = document.getElementById('sig_panel'),
b_show = document.getElementById('show'),
b_clear = document.getElementById('clear'),
pathdata = document.getElementById('pathdata');
//drawing functions
function isTouchEvent(e) {
return e.type.match(/^touch/);
}
function getCoords(e) {
if (isTouchEvent(e)) {
return e.targetTouches[0].clientX + ',' + e.targetTouches[0].clientY;
}
return e.clientX + ',' + e.clientY;
}
function down(e) {
signaturePath += 'M' + getCoords(e) + ' ';
p.setAttribute('d', signaturePath);
isDown = true;
if (isTouchEvent(e)) e.preventDefault();
}
function move(e) {
if (isDown) {
signaturePath += 'L' + getCoords(e) + ' ';
p.setAttribute('d', signaturePath);
}
if (isTouchEvent(e)) e.preventDefault();
}
function up(e) {
isDown = false;
if (isTouchEvent(e)) e.preventDefault();
}
//input handlers
r.addEventListener('touchstart', down, false);
r.addEventListener('touchmove', move, false);
r.addEventListener('touchend', up, false);
r.addEventListener('mousedown', down, false);
r.addEventListener('mousemove', move, false);
r.addEventListener('mouseup', up, false);
r.addEventListener('mouseout', up, false);
//helper functions
function clearSignature() {
pathdata.textContent = '';
signaturePath = '';
p.setAttribute('d', '');
}
function getSignature() {
pathdata.textContent = signaturePath;
return signaturePath;
}
//button handlers
b_show.addEventListener('click', getSignature);
b_clear.addEventListener('click', clearSignature);
svg {
margin: .5em;
border: 1px solid gray;
border-radius: .5em;
}
.flex {
display: flex;
}
button {
margin: .5em;
}
#pathdata {
font-family: monospace;
background: #ddd;
padding: 1em;
margin: 1em .5em;
}
Show signaure path data
Clear signature
1,791 23 23 silver badges 19 19 bronze badges
9,068 3 3 gold badges 29 29 silver badges 41 41 bronze badges
Highly active question . Earn 10 reputation (not counting the association bonus ) in order to answer this question. The reputation requirement helps protect this question from spam and non-answer activity.
Not the answer you're looking for? Browse other questions tagged ipad html canvas svg or ask your own question .
Stack Overflow
Questions
Help
Products
Teams
Advertising
Collectives
Talent
Company
About
Press
Work Here
Legal
Privacy Policy
Terms of Service
Contact Us
Cookie Settings
Cookie Policy
Stack Exchange Network
Technology
Culture & recreation
Life & arts
Science
Professional
Business
API
Data
Accept all cookies
Necessary cookies only
Find centralized, trusted content and collaborate around the technologies you use most.
Connect and share knowledge within a single location that is structured and easy to search.
Anyone know how this can be done? Would you use a canvas object, svg, jQuery, etc?
Here's another canvas based version with variable width (based on drawing velocity) curves: demo at http://szimek.github.io/signature_pad and code at https://github.com/szimek/signature_pad .
A canvas element with some JavaScript would work great.
In fact, Signature Pad (a jQuery plugin) already has this implemented.
Here is a quickly hacked up version of this using SVG I just did. Works well for me on my iPhone. Also works in a desktop browser using normal mouse events.
Perhaps the best two browser techs for this are Canvas, with Flash as a back up.
We tried VML on IE as backup for Canvas, but it was much slower than Flash. SVG was slower then all the rest.
With jSignature ( http://willowsystems.github.com/jSignature/ ) we used Canvas as primary, with fallback to Flash-based Canvas emulator (FlashCanvas) for IE8 and less. Id' say worked very well for us.
@szimek (selected answer) has a well-documented solution for those who want a full-featured module with a MIT license that's good-to-go. @heycam has a simpler solution that requires no libraries or plugins, has no licenses, and can be easily customized; all of which makes it a better fit for my needs. This post tries to explain how exactly his solution works.
Here's @heycam's solution as a runnable snippet:
Saving the path.d value on the server (and client cache) is all I need. Others may need to save the entire svg itself with path.d filled in, or convert it to other formats (JPEG, PNG, PDF) using appropriate converters (not covered here).
I plan to go a step beyond and add user controls to manage the following:
and theme the signature field (as part of my custom form lib):
Another OpenSource signature field is https://github.com/applicius/jquery.signfield/ , registered jQuery plugin using Sketch.js .
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.3.9.43293
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
Any question? Call us at (561) 880-4022
Sign In
or Register
Air Filters
Fast Moving parts
Superseded
Temporally Out of Stock
TUFF TORQ Parts
Graco Parts
Parts Lookup
Parts Manual
Belts
Blades
Chainsaws
Chainsaw Industrial
Chainsaw Lubricants Oils Chemicals
Chainsaw Mower
Chainsaw Silver Streak
Chainsaw Starter
Chainsaw Tools
Engine Parts -2- Cycle
Engine Parts -2- Cycle Industrial
Engine Parts -4- Cycle
Engine Parts -4- Cycle Fuel Parts
Engine Parts -4- Cycle Fuel Parts Industrial
Engine Parts -4- Cycle Golf Cart Parts
Engine Parts -4- Cycle Industrial
Engine Parts -4- Cycle Snowblower
Engines Industrial
Fuel Cans Tools
Fuel Cans Trimmer Trap
Fuel Parts
Fuel Parts Industrial
Fuel Parts Industrial True Blue
Go-Kart Mini-Bike
Golf Cart Parts & Accessories
Golf Cart Parts & Accessories Mower
Golf Turf Mower Parts
Golf Turf Mower Parts Mower
Golf Turf Mower Parts Mower - Electrical Starter
Golf Turf Mower Parts Mower Utility Vehicle
Golf Turf Mower Parts Tires Tubes Wheels
Handheld Equipment Parts Industrial
Handheld Equipment Parts Starter
Hedge Trimmer Silver Streak
Industrial
Industrial Mega-Fire Starter
Industrial Mower
Industrial Mower - Electrical
Industrial Pressure Washer
Industrial Spark Plugs & Accessories
Industrial Starter
Lubricants Oils Chemicals
Lubricants Oils Chemicals Tools
Mega-Fire Snowblower Starter
Mega-Fire Spark Plugs & Accessories
Mega-Fire Starter
Mower
Mower - Electrical
Mower - Electrical Sales Aids
Mower - Electrical Starter
Mower Snowblower
Mower Tires Tubes Wheels
Mower Utility Vehicle
Pressure Washer
Promotional Items
Safety
Silver Streak Trimmer
Snowblower Starter
Snowblower Tires Tubes Wheels
Spark Plugs & Accessories
Spark Plugs & Accessories Tools
Starter
Starter True Blue
Tiller
Tires Tubes Wheels
Tools
Trimmers
Engines
Snowblowers
Combos
AGRI-FAB Parts
ARIENS Parts
Блондинка приходит на сеанс эротического массажа ее пизду поливают маслом и дрочат
Визжит и стонет с хуем во рту
Мона Ли сняла юбку и трусики