Posts tagged: javascript

Firefox accelerometer

Paul Rouget shows off some cool new demos that are baking on the trunk of Firefox currently.

First are some nifty new events that get fired if your computer has an accelerometer:

JAVASCRIPT:

  1. window.addEventListener(“MozOrientation”, function(e) {
  2. /* 3 values: e.x, e.y, e.y */
  3. }, true)

It works with MacBooks and on Windows and Linux with Thinkpads.

Check out this cool screencast of the orientation event in action:

orientation_demo

They also have WebGL and CSS Transitions going in Firefox trunk now as well! There are some demos in the original blog post of WebGL + CSS3 + SVG as well as CSS Transitions + the HTML5 Video tag that are very cool (require Firefox Nightly).

Here’s an example code snippet showing how you can use CSS Transitions to change the background color of a DIV over time as well as changing the width and height of an HTML5 Video at the same time:

CSS:

  1. div {
  2. -moz-transition-property: background-color, height, width, font-size;
  3. -moz-transition-duration: 2s, 1s, 2s, 1s;
  4. -webkit-transition-property: background-color, height, width, font-size;
  5. -webkit-transition-duration: 2s, 1s, 2s, 1s;
  6. }
  7. div video {
  8. -moz-transition-property: width, height;
  9. -moz-transition-duration: 2s, 2s;
  10. -webkit-transition-property: width, height;
  11. -webkit-transition-duration: 2s, 2s;
  12. }

Someone’s also put together a cool demo that puts the new accelerometer support with some SVG to create a Super Mario Kart clone:

mario_orientation

Fonte:Ajaxian

CSS 3 Generator

Interactive CSS 3 Generator from Ajaxian by Brad Neuberg 9 people liked this Many browsers have been experimenting with new custom CSS properties lately. Keeping track (and learning how to use them) can be a bit of a challenge. Via WidgetPad comes a nifty CSS 3 Generator that helps you understand the new CSS 3 features in Webkit with an interactive tool that will build up and show how each new property affects an element. Here, for example, we see the results of applying rounded corners, box shadows, reflections, and a transform to an element: css3_generator_screenshot Which results in the following code: PLAIN TEXT CSS: 1. -webkit-border-radius: 10px; 2. -webkit-box-shadow: 5px 5px 5px rgba(0,0,0,0.5); 3. -webkit-box-reflect: below 5px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(0.5, transparent), to(white)); 4. -webkit-transform: rotateZ(15deg); The CSS 3 Generator works on any webkit based browser, including Safari, the iPhone, and Chrome. Here’s a challenge to the community: can you create an enhanced version of this that works with all the new CSS 3 and vendor-specific properties, including on IE and Firefox, hiding the options that don’t work on specific browsers? That would turn this into a more general purpose educational and testing tool that would be very valuable. Even better if you open source it and we can host it on the Open Web Developer Network we’ve been kicking around. Drop me a line if you create such a thing :) As a side note, I had never seen the WidgetPad website where this is hosted before this which looks quite interesting. From the site: [WidgetPad is a] collaborative development environment for developers to develop fully-interactive, stand-alone, downloadable SmartPhone applications in HTML5, CSS3 and Javascript. You don’t need to install any special development tools or learn any platform-specific API sets. WidgetPad offers everything you need — project management, source code editing, debugging, collaboration, versioning and even distribution — in your own browser!

Fonte: Ajaxian

Preload Page

The classic animated gif, or the “loading…” text, could be now easily replaced thanks to this new jQuery plug-in.

Specially suited for a page loads of images, the final result showed in this demo looks really nice and flashy.

Features:

  • Preload a whole web page.
  • Preload a part of the page.
  • Gets all images, <img> tags and background-image of your CSS
  • Easy to implement.
  • Adjustable loading bar.
  • Tested in Firefox, Safari, Opera, Chrome, IE7, IE8 and IE6 (script will be ignored in IE6 though).

Full post, demo, and source code, are in Gaya Design blog.

To be honest, I instantly had a thought about this technique:  wasn’t the DOMContentLoaded event purpose the one to avoid people waiting a full page download before they’re allowed to interact with it? … never mind, we cannot do much in any case in front of images dedicated layouts.

Fonte:GayaDesign

Open web tools mozilla labs

A mozilla labs criou um directório, onde podem ser encontradas de uma forma simples e rápida várias “ferramentas” para programadores, tentaram reunir numa só página algumas das ferramentas conhecidas dos programadores.

http://tools.mozilla.com/

E claro tudo ferramentas opensource.

A página ainda dispõem de um formulário de pesquisa, muito útil caso queiram pesquisar só pelo design , código etc..

jCarousel

Riding carousels with jQuery

Author: Jan Sorgalla
Version: 0.2.3 (Changelog)
Download: jcarousel.tar.gz or jcarousel.zip
Licence: MIT and GPL
Documentation: http://sorgalla.com/projects/jcarousel/

jCarousel is a jQuery plugin for controlling a list of items in horizontal or vertical order. The items, which can be static HTML content or loaded with (or without) AJAX, can be scrolled back and forth (with or without animation).

Examples

The following examples illustrate the possibilities of jCarousel:

JavaScript : Prototype e LibSAPO.js

Apresentação Prototype e LibSAPO.js, realizada pelo Cláudio Gamboa na segunda SAPO Session.

Ajax – Acentuação

como resolver o problema de acentuação do  ajax apenas com uma linha de código.

Basta acrescentar esta linha ao conteúdo.

<?php header(“Content-Type: text/html; charset=ISO-8859-1″,true) ?>

como escrever um código javascript limpo e bonito

Nicholas Zakas é um engenheiro na equipa da YUI

WordPress Themes