background preloader

JavaScript UI Library, Ajax Components & HTML5 Framework - DHTMLX

JavaScript UI Library, Ajax Components & HTML5 Framework - DHTMLX

Carte de France cliquable en SVG avec la librairie js Raphaël Je vous propose de faire une carte cliquable des régions françaises (hors Dom Tom), le but ici est d’avoir une carte compatible avec les anciens navigateur (oui même notre ami IE) et sur un maximum de terminaux, donc adieu flash (Flash n’étant pas supporté sur les ipad, iphone et Android). On va donc se concentrer sur le format SVG (wikipédia) et surtout pour assurer la compatibilité avec les anciens navigateurs on va utiliser la librairie JS Raphael. Voici les étapes * Volontairement je ne m’étendrais pas sur la création du fichier SVG, mais sachez qu’avec un logiciel de dessin vectoriel comme inkscape, en sélectionnant un objet (les contours des départements par exemple) et en faisant Ctrl+ Maj + X (Editeur XML) la première ligne « d » correspond aux coordonnées dont nous avons besoin. Voilà vous avez téléchargé les fichiers, nous allons créer une simple page web nommée index.html, et un répertoire « js » pour nos fichiers javascript. Créer notre page web : <! Sources :

arbor.js Raphaël—JavaScript Library Introduction to Raphaël.js Introduction SVG, short for Scalable Vector Graphics, is a XML-based language for describing objects and scenes. SVG elements can fire events and can be scripted with JavaScript. Drawing Your First Scene Let's begin by drawing a simple scene with Raphaël. Each SVG object can have attributes assigned to it for things like the the color, rotation, stroke color and size, etc. Drawing Advanced Shapes with Paths A path is a series of instructions used by the renderer to create objects. The code and figure below show a rectangle and closed curved drawn with paths. Drawing Text Having illustrations without the ability to draw text would be really boring, luckily, Raphaël provides two methods to draw text. The second method, print, draws the text as a collection of paths. The Vegur font isn't in Raphaël, nor is any font for that matter. Events The snippet below binds a function to rotate a given letter in "ROCKS" 45 degrees when it is clicked. SVG vs Canvas Authoring Tools for SVG svg-edit Inkscape

spin.js JSON jQuery throttle / debounce: Sometimes, less is more! jQuery throttle / debounce allows you to rate-limit your functions in multiple useful ways. Passing a delay and callback to $.throttle returns a new function that will execute no more than once every delay milliseconds. Passing a delay and callback to $.debounce returns a new function that will execute only once, coalescing multiple sequential calls into a single execution at either the very beginning or end. Note for non-jQuery users jQuery isn’t actually required for this plugin, because nothing internal uses any jQuery methods or properties. jQuery is just used as a namespace under which these methods can exist. Since jQuery isn’t actually required for this plugin, if jQuery doesn’t exist when this plugin is loaded, the methods described below will be created in the Cowboy namespace. Throttle versus debounce Both throttling and debouncing will rate-limit execution of a function, but which is appropriate for a given situation? Throttling A Visualization Key: Usage example 07. 11. 15. Debouncing

jQuery UI DatePicker: Disable Specified Days One project I'm currently working on requires jQuery. The project also features a datepicker for requesting a visit to their location. jQuery UI's DatePicker plugin was the natural choice and it does a really nice job. One challenge I encountered was the need to prevent specific days from being picked. The jQuery JavaScript The base code is taken from this forum post. I'd like to see jQuery UI implement a standard way of disabling days. Be Heard Tip: Wrap your code in <pre> tags or link to a GitHub Gist! Older Sliding Labels Using MooTools Newer Printing MooTools Accordion Items

Script Junkie | Creating Responsive Applications Using jQuery Deferred and Promises Today we’re going to explore the concept of deferreds - an important feature found in JavaScript toolkits such as dojo and MochiKit, which recently also made its debut to popular JavaScript library jQuery. Deferreds offer a solution for abstracting non-blocking elements (such as the response to ajax requests) and achieve this by creating a ‘promise’ which aims to return a response at some point in the future. If you haven’t come across the concept of ‘promises’ before, we'll be covering them in some detail shortly. At a high-level, deferreds can be thought of as a way to represent costly operations which can take a long time to complete. Promises Some of the material you may read on promises and deferreds may focus on quite implementation-specific applications of it. In its most basic form, a ‘promise’ is a model that provides a solution for the concept of deferred (or future) results in software engineering. promise = callToAPI( arg1, arg2, ...) jQuery Deferreds Further Deferreds examples