Spraycan - vandalise your page
This is what Mitya does when he's bored. This allows you - or rather your site visitors - to take a break from reading your blurb and graffiti your page like it was a wall.
Once the ap starts, you paint by clicking and dragging on the screen. A toolbox allows you to pick the brush colour and size.
Click here to vandalise my homepage. I know, I know. I did tell you I was bored.
Head over here to download, get usage info or view a demo.
The only problem is that clicking and dragging always means selecting text. To my mind there's no way around this apart from in IE (which defines a special text select event, whereas in other browsers you can only return false from the onmouseodwn event - not really an option for a script that listens for mousedown to know when to start painting).
One possible fix would be to append brush strokes to a new, invisible canvass rather than to the itself. Then, during painting, calling event.stopPropagation() would ensure the drag action never made it as far as the body's text elements.
2 comments | post newTable sort update - sorting on child element
The reception to my animated table sort plugin, posted a few weeks ago, has been great. A number of blogs, articles and tweets have featured it.
Some people have asked if it's possible to sort on the content of a child element of each
So if each
1$('#example1_table').sortTable({
2 onCol: 1,
3 keepRelationships: true,
4 child: 'input'
5});
It's important that your selector matches only one element per
child: 'input.mytextfield'
Head over here to download, get usage info or view a demo.
post a commentjQuery drop-down selector
UI / UX developers have long wished the built-in was a little more tangible, rather than a bunch of options that have no meaning until you set up some Javascript to detect and act on their selection.
Dropdown is a simulation of the in-built , except with links, not options, and allowing you to specify the behaviour of each link (callback? disabled?) and precisely how the drop-down looks.
Head over here to download, get usage info or view a demo.
You call it by running dropdown(linkData), where 'linkData' is an array containing objects that hold data about each link, like so:
1dropdown([
2 {url: 'http://www.yahoo.co.uk', text: 'Yahoo!'],
3 {text: 'Bing', click: function() {
4 alert("Sorry - we're not going to Bing right now");
5 }},
6 {url: 'http://www.google.co.uk', text: 'Google', disabled: true}
7]);
As with everything I write, it's just one file. No dependent HTML or CSS - everything's DOM-scripted by the scirpt and styled within it, too.
post a commentBlockster transition effect
Just posted this in the scripts section. Blockster is a cool transition effect designed for 'featured content' rotators or slideshows, transitioning between slides block by block.
Head over here to download, get usage info or view a demo.
The script gives you full control over how the script behaves, giving you scope to create some pretty varying effects.
You can set the number of rows and cols in the block grid, whether the blocks should fade in or simple appear, whether they should appear randomly or in order, and more.
post a commentHello, world
I'm a London-based Javascript specialist, focussing on native JS, jQuery, XSL and related technologies.
Latest content
My projects/writings
XMLPlayground.com - a sandbox for XML development, including (E)XSLT, XQuery, DTD, Schema and more
- Ten Oddities and Secrets of JavaScript
- Commonly Confused Bits of jQuery
- Image Manipulation with jQuery and PHP-GD
- Get Serious with JavaScript: Learn RegExp (in print copies only)
- Catching Up with jQuery's Newer Versions (submitted for print...)
Archive
-
2012
-
Aug
- > Article by me in next issue of .NET
-
Jul
- > The magic of JavaScript's apply()
- > REGEX round-up: two issues...
-
Jun
- > What have you tried?
- > XMLPlayground.com - my new project
-
May
- > A look at native JSON support in ECMA5
-
Apr
- > Distinguishing real events from simulated events
- > Non-AJAX use for jQuery's deferred objects
-
Mar
- > JSON-P: what it is, what it's not and how it works
- > JavaScript getters and setters: varying approaches
-
Feb
- > ECMAScript 5: a revolution in object properties
- > A friendly alternative to currying
- > Presenting XMLTree v.2.0
-
Jan
- > Numberfy: add line numbers to your textareas
- > JSON and PHP: formatting and validating
-
-
2011
-
Dec
- > Being Firebug, pt2: which rules, which elements?
- > Being Firebug, pt1: reading CSS in Javascript
-
Nov
- > Additions to XML tree; jQuery XML parsing
- > BAPS (browser and plugin sniffer)
- > Roundup: animated table sort / browser sniffing
-
Oct
- > Annoyances with client-side XSL transformation
- > XML Tree - visualise and traverse your XML
-
Sep
- > Fiddler - when debugging needs to go nuclear
- > My article in .NET / update to Dropdown
-
Aug
- >
- > Using Dropdown as a fancy form field
- > The site gets a spring-clean
-
Jul
- > REGEX article by me in .NET magazine
-
Jun
- > Understanding multi-line mode for JS REGEX
- > On-the-fly conversion of Flash to image for iOS
-
May
- > My new article on JS oddities and well-kept secrets
- > Understanding Javascript self executing functions
-
Apr
- > Twisted logic: understanding truthy and falsy
- > New Smashing article by me on image manip
-
Mar
- > Update to lightbox and lightbox dialog
- > Update to date calculator script
- > Bizarre webkit bug with 'typeof'
-
Feb
- > Simulating REGEX look-behinds in JavaScript
- > Smashing jQuery out now (I was technical editor...)
- > Bouncy text plugin
-
Jan
- > Uber-customisable video carousel
-
-
2010
-
Dec
- >
-
Nov
- > XML-to-JSON convertor and remapper
- > Table sorter: toggling sort direction
-
Oct
- > Blockster - fixed for jQuery v1.4.3
- > Like my work? Remember it's free...
- > JAWS: news ticker and mini accordion
- > Sliding block puzzle game in Javascript
-
Sep
- > Round-up: IE6 radio bug; updated Dropdown...
- > Talking to the zebra: new comments system
- > Blockster update: controlling it with navigation
- > My new carousel - now documented!
-
Aug
- > Mitya's lovely new carousel
- > How to: detect internet connection in Javascript
- > jQuery article by Mitya on SmashingMagazine.com
-
Jul
- > Spraycan - vandalise your page
- > Table sort update - sorting on child element
- > jQuery drop-down selector
- > Blockster transition effect
-
Jun
- > How to: get the node index of an element
- > Match elements via REGEXP in jQuery
- > GD barchart generator
- > Table sort - now REGEXP friendly
- > UI for Postcode Anywhere address look-up
- > Animated table sort
- > Ajaxify - re-route your forms via AJAX
- > curveMe - cross-browser curvy corners
- > Calculate time between two dates
-
May
- > Calendar and date-picker
- > Domscripter - reduce your DOM-scripting code
- > MSThis - simulate W3C events in IE
- > Lightbox and lightbox dialog
- > Hello, world
-
Other stuff, er...
...I lead front-end development at London-based Espresso Education. More info...
...I'm part of the O'Reilly Blogger Review Scheme