jQuery plugin – simple numeric field

I’ve written very simple jQuery plugin which prevents user from entering non-numeric values to input field. It is available on Github. Allowed values are “0-9 + – , .” //Example of use $(‘input’).numberField(); Live DEMO here Update: It was not possible to write numbers on czech keyboard in a way like “Shift+š”. Fixed now. Credits: Jiří Knesl and his ESCR script. People from Slovakia might use his LSCR script useful 🙂

Continue Reading

Rotate table cell content with jQuery

Rotating text via CSS is now relatively easy. There is a few of good tutorials and demos out there. But they lack one thing – they don’t explain how to rotate text in a table cell. Few days ago during pair programming with Michal Tehnik we run into trouble. We managed to rotate the text, but it only worked properly in Internet Explorer. (via writing-mode)   In Chrome and Firefox the table cells shrinked, because elements rotated via css rotate property are still “placed” in their original position. To fix this behaviour we need to calculate first width and height …

Continue Reading

Simple inheritance via jQuery.extend

Spoiler warning: This is not true inheritance as we are used have to in static languages. It is not even prototypal inheritance. It is merely an experiment to find out if it is possible to achieve (mock) inheritance using jQuery.extend() method. And yes, it is kind of possible. JQuery.extend basically copies properties from one object onto another. So in order to mock inheritance you have to extend instance (or instances) of ‘parent class’ with properties of another objects. Here is how I did it: $(function() { var Parent = function() { var that = this; this.name = ‘david’; this.getName = function() { return …

Continue Reading

Don’t forget to play

Sometimes I need to do something what is not useful at all, just for the fun of it.  Someone plays World of Warcraft as a hobby, someone listens to music, drinks, draws.. whatever. I make animations in javascript.  It’s half fun and half learning. I can try new things, I can experiment, discover …and what is most important: I create. After one rather bad day at work I needed to do something what I would really enjoy.  Not that I don’t like my work, I do love it, but there are sometimes days that are just bad… I had a …

Continue Reading

Fun with tooltips on a timeline

This is a fun script I created during my idle hours while at previous employer.  I wanted to somehow mimic comix-like conversation but on a single image only.  It was just for fun, but it can be however used to do something more useful;) What it basically does is that it displays tooltips in a predefined order. Click image below to see demo. I wrote simple timeline object which acts as a controller of tooltips – it shows them in given time above given DOM objects.  There is a few of tooltips build on jQuery, but qTip offers loads of …

Continue Reading

jQuery.durationpicker plugin

[Important Notice: I’ve discovered some bug in demo of durationPicker. It runs correctly only in FF. I will fix it soon and notify you here.]   Have you ever looked at Googles’s (excellent) calendar app and wished that you had the  ‘event planing widget’ in your web form? Well, here is my own version, a reversed engineered one, which I give for free use. It was originaly developed for company I work for, and was not intended to be a completely standalone plugin, so there are still some dependencies. More on that later. Basic functionality is quite the same as …

Continue Reading