[ del.icio.us poetry ]

http://www.catswhocode.com/blog/how-to-easily-monitor-your-web-server-using-php
How to easily monitor your web server using PHP
Posted by Jean-Baptiste Jung on Feb 8, 2010 | 4 comments

How to easily monitor your web server using PHP

In order to make sure that your website is always available to the public, you have to monitor it. In this tutorial, I’ll show you how you can easily create a monitoring script that will check your website availability and send an email or sms alert to you if it isn’t.

Prerequisites

Maybe I’m stating the obvious, but the PHP script has to be on a different server than the one used for the website you’d like to monitor. If the script is hosted on the same server than your site, it becomes pretty useless: In fact, if your server is down the script will not be able to run and will not let you know.
The best solution is of course a dedicated server, but a home server can be ok as well. Shared web hosting like those provided by Hostgator or WpWebHost have a low price, but most don’t allow you to set up cron jobs, so be careful if you plan to buy.

The last part of this tutorial will show you how to get sms alerts using Gmail. Please note that depending on your location and cellular phone provider, this part of the tutorial may not work.

1. Creating the monitoring script

The first part of this tutorial is to create the monitor script. Pick up your favorite text editor and create a file named monitor.php. The script is very simple: we only need two functions, one to test if a specific site is available, and the other to alert you by sending an email.

Paste the following in your monitor.php file:

function check($host, $find) {
    $fp = fsockopen($host, 80, $errno, $errstr, 10);
    if (!$fp) {
        echo "$errstr ($errno)\n";
    } else {
       $header = "GET / HTTP/1.1\r\n";
       $header .= "Host: $host\r\n";
       $header .= "Connection: close\r\n\r\n";
       fputs($fp, $header);
       while (!feof($fp)) {
           $str .= fgets($fp, 1024);
       }
       fclose($fp);
       return (strpos($str, $find) !== false);
    }
}

function alert($host) {
    mail('youremail@gmail.com', 'Monitoring', $host.' down');
}

$host = 'www.catswhoblog.com';
$find = 'Cats Who Code';
if (!check($host, $find)) alert($host);

The first function we created here, check(), takes two parameters: The first is the server you’d like to check availability (for example, www.catswhocode.com) and the second parameter is to find some text on the webpage. This second parameter is an additional security: In fact, by checking if a specific word is contained on the site homepage, we ensure that the site content hasn’t been modified, for example, after a hacking.

If the server isn’t available or if the text to find hasn’t been found, the alert() function is executed, and will send an email to the account of your choice.

Save the monitor.php file and upload it to your monitoring server.

2. Defining a cron job

At this point of the tutorial, we have a working monitoring script, but we have to type http://mymonitoringserver.com/monitor.php in a web browser to check our website, which makes our script almost useless.
The solution to that problem is to create a cron task to make the server execute monitor.php every hour. Open a SSH console to your monitor server and type the following:

0 * * * * /usr/local/bin/php -q /htdocs/www/monitor.php

If your PHP scripts do not have executable permissions, 644 or -rw-r–r– for example, then as part of the command portion of the cron line, you must specify the php interpreter and pass it the filename of the PHP script (including full path to the script from your home directory) that you want executed.

3. Setting up SMS alerts

Right now, we have a working monitoring PHP script, as well as a cron job that will execute the script every hour. If a problem happens, you’ll receive an email.
Due to the popularity of iPhones, Blackberries and other SmartPhones, a lot of people are able to receive emails everywhere they are. Though, some are still using cell phones with no email capability. In this optional step of the tutorial, let’s see how we can easily receive alerts by sms.

Doing so is quite easy. First you have to use Gmail. As it is a free service, you can create a dedicated account for your monitoring alerts. Once finished, login to your account and click on the “Settings” link located on the top right side of the browser window.
Then, select “Forwarding and POP/IMAP”:

As shown in the previous screenshot, the only thing you have to do is to check “Forward a copy of incomming mail” and fill the field with your phone number @ your provider service.
For example, If your phone provider is AT&T, you’ll have to type 0000000000@mobile.att.net.

4 Comments + Trackbacks  

  1. 96th
    2.8.2010

    LOL, my webhosting has an uptime of over 476 days. Still Dugg.

  2. Trav
    2.8.2010

    So many thanks for this article. I’ve been trying to figure this out for a few weeks now (in between my more important tasks), so this couldn’t have arrived at a better time. Using a monitoring service in the interim, but really glad I can now roll my own.

    BTW, I found the following resource helpful when messing around with the Cron job, which was the part I hadn’t done before. I didn’t know what the ‘-q’ flag was intended for, but after reading php.net/manual/en/features.commandline.php I discovered it’s to prevent headers from being emitted when the script is called- makes sense.

    Thanks again!

    Trav

  3. Trav
    2.8.2010

    One other comment: I’ve noticed that it seems to stumble when it comes to dealing with .htaccess redirects; specifically, the 301’s in my site are causing a false positive. Wondering if you have any thoughts on troubleshooting.

  4. Codesquid
    2.9.2010

    A nice useful article! I wonder how other people do this kind of thing? Do they maybe use a similar script?

Leave A Response

Comments guidelines:
Dofollow comments
No keyword in name field
No links in comments
Trackbacks are counted, but not displayed

  

  

  

Proud member of the Smashing Network

http://home.earthlink.net/~etunstal/diy.htm
http://www.mauriciodenassau.edu.br/
http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery
My favorites | English | Sign in

Google AJAX Libraries API

Developer's Guide

The AJAX Libraries API is a content distribution network and loading architecture for the most popular, open source JavaScript libraries. By using the google.load() method, your application has high speed, globally available access to a growing list of the most popular, open source JavaScript libraries.

Table of Contents

Audience

This documentation is designed for people familiar with JavaScript programming and object-oriented programming concepts. There are many JavaScript tutorials available on the Web.

Introduction

The AJAX Libraries API provides your applications with stable, reliable, high speed, globally available access to all of the most popular, open source JavaScript libraries. Your application can use our very flexible loader google.load() or direct, path based access to the scripts.

Using google.load()

The most powerful way to load the libraries is by using google.load() to name a library and your prefered version. E.g.:

  google.load("jquery", "1.4.1");
  google.load("jqueryui", "1.7.2");
  google.load("prototype", "1.6.1.0");
  google.load("scriptaculous", "1.8.3");
  google.load("mootools", "1.2.4");
  google.load("dojo", "1.4.1");
  google.load("swfobject", "2.2");
  google.load("yui", "2.8.0r4");
  google.load("ext-core", "3.1.0");

As you can see in the code snippets above, the first argument to google.load is the name of a library. The second argument is a version specification. The complete list of Ajax libraries is a growing collection of the most popular, open source JavaScript libraries.

Versioning with google.load()

The versioning system allows your application to specify a desired version with as much precision as it needs. By dropping version fields, you end up wild carding a field. For instance, consider a set of versions:

1.9.1
1.8.4
1.8.2

Specifying a version of "1.8.2" will select the obvious version. This is because a fully specified version was used. Specifying a version of "1.8" would select version 1.8.4 since this is the highest versioned release in the 1.8 branch. For much the same reason, a request for "1" will end up loading version 1.9.1. Note, these versioning semantics work the same way when using google.load and when using direct script urls.

Ajax Libraries

Each library is available via both google.load() and directly, via <script/> tag. The google.load() approach offers the most functionality and performance. In the sections that follow, we document all of the libraries that are available. For each library we list its name (as in the name used in google.load()), all of the versions that we have on hand for the library, etc.

jQuery
name: jquery
versions: 1.2.3, 1.2.6, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1
load request: google.load("jquery", "1.4.1");
extras: uncompressed:true, e.g., google.load("jquery", "1.4.1", {uncompressed:true});
path: http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js
path(u): http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js
site: http://jquery.com/
note: 1.2.5 and 1.2.4 are not hosted due to their short and unstable lives in the wild...
jQuery UI
name: jqueryui
versions: 1.5.2, 1.5.3, 1.6, 1.7.0, 1.7.1, 1.7.2
load request: google.load("jqueryui", "1.7.2");
extras: uncompressed:true, e.g., google.load("jqueryui", "1.7.2", {uncompressed:true});
path: http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js
path(u): http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js
site: http://ui.jquery.com/
note: This library depends on jquery. Before loading this module, you must load jquery. e.g.:
  google.load("jquery", "1.4.1");
  google.load("jqueryui", "1.7.2");
Prototype
name: prototype
versions: 1.6.0.2, 1.6.0.3, 1.6.1.0
load request: google.load("prototype", "1.6.1.0");
path: http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js
site: http://www.prototypejs.org/
script.aculo.us
name: scriptaculous
versions: 1.8.1, 1.8.2, 1.8.3
load request: google.load("scriptaculous", "1.8.3");
path: http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js
site: http://script.aculo.us/
note: This library depends on Prototype. Before loading this module, you must load Prototype. e.g.:
  google.load("prototype", "1.6");
  google.load("scriptaculous", "1.8.3");
MooTools
name: mootools
versions: 1.1.1, 1.1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4
load request: google.load("mootools", "1.2.4");
extras: uncompressed:true, e.g., google.load("mootools", "1.2.4", {uncompressed:true});
path: http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js
path(u): http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools.js
site: http://mootools.net/
note: Since 1.1 versions are not compatible with 1.2 versions, specifying version "1" will map to the latest 1.1 version (currently 1.1.2).
Dojo
name: dojo
versions: 1.1.1, 1.2.0, 1.2.3, 1.3.0, 1.3.1, 1.3.2, 1.4.0, 1.4.1
load request: google.load("dojo", "1.4.1");
extras: uncompressed:true, e.g., google.load("dojo", "1.4.1", {uncompressed:true});
path: http://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js
path(u): http://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js.uncompressed.js
site: http://dojotoolkit.org/
SWFObject
name: swfobject
versions: 2.1, 2.2
load request: google.load("swfobject", "2.2");
extras: uncompressed:true, e.g., google.load("swfobject", "2.2", {uncompressed:true});
path: http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js
path(u): http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject_src.js
site: http://code.google.com/p/swfobject/
Yahoo! User Interface Library (YUI)
name: yui
versions: 2.6.0, 2.7.0, 2.8.0r4
load request: google.load("yui", "2.8.0r4");
extras: uncompressed:true, e.g., google.load("yui", "2.8.0r4", {uncompressed:true});
path: http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/yuiloader/yuiloader-min.js
path(u): http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/yuiloader/yuiloader.js
site: http://developer.yahoo.com/yui/
Ext Core
name: ext-core
versions: 3.0.0, 3.1.0
load request: google.load("ext-core", "3.1.0");
extras: uncompressed:true, e.g., google.load("ext-core", "3.1.0", {uncompressed:true});
path: http://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js
path(u): http://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core-debug.js
site: http://extjs.com/products/extcore/
Chrome FrameNew!
name: chrome-frame
versions: 1.0.0, 1.0.1, 1.0.2
load request: google.load("chrome-frame", "1.0.2");
extras: uncompreassed:true, e.g., google.load("chrome-frame", "1.0.2", {uncompressed:true});
path: http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js
path(u): http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.js
site: http://code.google.com/chrome/chromeframe/
http://mw.concord.org/modeler/

Featured simulation

Do you know how a scanning tunneling microscope (STM) works? These simulations will walk you through the physical principles of STM and explain how they are used to image and manipulate atoms.

Featured activities

The following images show some selected activities produced by the Molecular Workbench Team of the Concord Consortium using MW. Move the mouse over an image to see a short description about the corresponding MW activity, and click the image to launch it. When learning with an MW activity, students can save their work in an Internet portfolio, create reports, and submit reports for grading.

Semiconductor
Quantum mechanics
Cellular respiration
Diffusion
Heat & temperature
Electrostatics
Phase change
DNA to protein
Newton's Laws
Lipids & carbs
Proteins & nucl. acids
Harvest light
Tree of life
Fluid mechanics
Chemical bonding
ELISA

More in MW…

Creating your own simulations

MW is not just a collection of simulations--do not be deceived by first glance. While it presents many existing simulations that are ready to use in classroom, it is, however, also a modeling tool for teachers and students to create their own simulations and share them with collaborators. There are very sophisticated modeling capacities hidden behind its simple user interface that empower you to create new simulations and even explore the unknowns.

Creating your own learning activities

A simulation without instructional support is difficult for students. An optimal way of using simulations is to embed them into curriculum materials. MW has an authoring system for teachers and curriculum developers to create or customize their own online lessons that use models and simulations. A typical MW activity is a comprehensive learning package consisting of a series of scaffolded pages that contain text, simulations, tools, controls, graphs, navigation links, and embedded assessments. The user interfaces of simulations in MW can be customized for students of different levels (grades 6-16). This unique characteristic feature enables it to support a wide range of instructional strategies such as inquiry-based, discovery-based, and problem-based learning.

Fun stuff

The following are some fun simulations and games made using MW. Enjoy.
Electrostatic maze
Maze 3D
Water wheel
Block feeder
Bike
Dainty walker







http://www.w3.org/WAI/ER/tools/complete.html
http://maemo.org/

Bluetooth Dial-Up Networking 1.0-6

Activate tethering over Bluetooth DUN

This program will turn on the Bluetooth Dial-Up Networking (DUN) service, to allow tethering; the actual service is provided by Maemo.

****
More

news

Feed
More
http://net.tutsplus.com/tutorials/javascript-ajax/24-best-practices-for-ajax-implementations/
http://www.w3schools.com/css/css_colornames.asp
http://www.rivalmap.com/
RivalMap screenshot

Organize

RivalMap makes sharing information easy, whether you're centralizing market-related information across teams, or building collaborative competitor profiles.

Discover

Improve your ability to keep tabs on what's happening around you. Monitor competitor updates and industry topics, collect and share important news, and more.

Integrate

It's easy to get going with RivalMap since it fits into your routine with email alerts and RSS integration, as well as the ability to contribute through email.

Secure and Private

All RivalMap accounts are completely secure and private. We have a strong commitment to keeping all of your data confidential. To find out more, please read our Privacy Policy and Security Statement.

http://pixelmatrixdesign.com/uniform/#example

Download

Download Uniform jquery.uniform.zip (155kb)

Get source on GitHub

version 1.5 (2/9/2010)

Uniform styles:

  • Selects (Drop downs)
  • Checkboxes
  • Radio buttons
  • File Upload inputs

Tested & Compatible in:

  • Safari 3+
  • Firefox 3+
  • IE7+
  • Chrome
  • jQuery 1.3+

Have you ever wished you could style checkboxes, drop down menus, radio buttons, and file upload inputs? Ever wished you could control the look and feel of your form elements between all browsers?

If so, Uniform is your new best friend.

Uniform masks your standard form controls with custom themed controls. It works in sync with your real form elements to ensure accessibility and compatibility.

Meet Uniform

Documentation

Installation

Installation of Uniform is quite simple. First, make sure you have jQuery 1.3+ installed. Then you’ll want to link to the jquery.uniform.js file and uniform.default.css in the head area of your page:

<script src="jquery.uniform.js" type="text/javascript"></script>
<link rel="stylesheet" href="uniform.default.css" type="text/css" media="screen" charset="utf-8" />

Basic usage

Using Uniform can be quite easy as well. Simply call:

$("select").uniform();

To “uniform” all possible form elements, just do something like this:

$("select, :checkbox, :radio, :file").uniform();

Extra parameters

You can pass in extra parameters to control certain aspects of Uniform. To pass in parameters, use syntax like this:

$("select").uniform({
  param1: value,
  param2: value,
  param3: value
});
selectClass (string)

Default: "selector"

Sets the class given to the wrapper div for select elements.

$("select").uniform({selectClass: 'mySelectClass'});
radioClass (string)

Default: “radio”

Sets the class given to the wrapper div for radio elements.

$(":radio").uniform({radioClass: 'myRadioClass'});
checkboxClass (string)

Default: “checker”

Sets the class given to the wrapper div for checkbox elements.

$(":checkbox").uniform({checkboxClass: 'myCheckClass'});
fileClass (string)

Default: “uploader”

Sets the class given to the wrapper div for file upload elements.

$(":file").uniform({fileClass: 'myFileClass'});
filenameClass (string)

Default: “filename”

Sets the class given to div inside a file upload container that spits out the filename.

$(":file").uniform({filenameClass: 'myFilenameClass'});
fileBtnClass (string)

Default: “action”

Sets the class given to div inside a file upload container that acts as the “Choose file” button.

$(":file").uniform({fileBtnClass: 'myFileBtnClass'});
fileDefaultText (string)

Default: “No file selected”

Sets the text written in the filename div of a file upload input when there is no file selected.

$(":file").uniform({fileDefaultText: 'Select a file please'});
fileBtnText(string)

Default: “Choose File”

Sets the text written on the action button inside a file upload input.

$(":file").uniform({fileBtnText: 'Choose&hellip;'});
checkedClass (string)

Default: “checked”

Sets the class given to elements when they are checked (radios and checkboxes).

$(":radio, :checkbox").uniform({checkedClass: 'myCheckedClass'});
focusClass (string)

Default: “focus”

Sets the class given to elements when they are focused.

$("select").uniform({focusClass: 'myFocusClass'});
disabledClass (string)

Default: “disabled”

Sets the class given to elements when they are disabled.

$("select").uniform({disabledClass: 'myDisabledClass'});
activeClass (string)

Default: “active”

Sets the class given to elements when they are active (pressed).

$("select").uniform({activeClass: 'myActiveClass'});
hoverClass (string)

Default: “hover”

Sets the class given to elements when they are currently hovered.

$("select").uniform({hoverClass: 'myHoverClass'});
useID (boolean)

Default: true

If true, sets an ID on the container div of each form element. The ID is a prefixed version of the same ID of the form element.

$("select").uniform({useID: false});
idPrefix (string)

Default: “uniform”

If useID is set to true, this string is prefixed to element ID’s and attached to the container div of each uniformed element. If you have a checkbox with the ID of “remember-me” the container div would have the ID “uniform-remember-me”.

$("select").uniform({idPrefix: 'container'});
resetSelector (boolean/string)

Default: false

This parameter allows you to use a jQuery-style selector to point to a “reset” button in your form if you have one. Use false if you have no “reset” button, or a selector string that points to the reset button if you have one.

$("select").uniform({resetSelector: 'input[type="reset"]'});

Additional functions

In addition to the parameters, there are a couple of other ways you can interact with Uniform.

$.uniform.update([elem/selector string]);

If you need to change values on the form dynamically you must tell Uniform to update that element’s style. Fortunately, it’s very simple. Just call this function, and Uniform will do the rest.

$.uniform.update("#myUpdatedCheckbox");

If you are lazy, or just don’t specifically know which element to update, you can just leave out the parameter (see below) and Uniform will update all Uniformed elements on the page:

$.uniform.update();
$.uniform.elements[]

You can get an array of all the elements that have been Uniformed at any time using this public variable. Wouldn’t advise changing the contents though!

Returns: Array [DOM Elements]

var uniforms = $.uniform.elements;

Tips & tricks

Uniform is supposed to be pretty simple, but there are a few things that can be tricky. Here are some tips that may make your experience simpler:

Remember to change the CSS classes in the theme if you change the parameters for elements’ classes. This can be tedious work, but if you don’t do it, it’s not going to look correct. Find and Replace is your friend.

Uniform cannot automatically sniff out dynamic value changes. If you make changes to elements in Javascript or using a Reset button of some kind remember to call $.uniform.update(); to sync the changes with Uniform.

Uniform is disabled in IE6. It’s not possible to fix due to the way IE6 handles form elements. If you care about IE6 users, give it a quick look to make sure your “naked” form elements look alright in there.

You’re on your own for styling text inputs and more. Fortunately, things that are not handled by Uniform are pretty easy to skin. :)

If you have ideas, or bugs, please post them in GitHub. We rely on our users for ideas for improvements and bug reports. Otherwise Uniform will stay static.

Themes

Theming is central to the philosophy of Uniform. We don’t want you to feel limited to just using the default style. You can design your own theme with our theme kit and create most of the code you’ll need using our custom theme generator.

You can also download themes created by others. Here are some of our favorites:

Uniform Default by Josh Pyles Download
Aristo by Made by Sofa / ported by Josh Pyles Download

Contribute

Have ideas for Uniform? Want to submit a bug fix or patch? We collaborate on Uniform on GitHub, and we welcome you to join us as well! Visit Uniform on GitHub.

http://css-tricks.com/jquery-magicline-navigation/

jQuery MagicLine Navigation

Posted on: 2/9/2010   By: Chris Coyier 10 Comments

These “sliding” style navigation bars have been around a while, I just thought I’d take a crack at doing it myself as the opportunity came up recently. Turns out it’s really pretty darn easy. I put two examples together for it.

The Idea

The idea is to have a highlight of some kind (a background or an underline) follow you around as you mouse over the different links in the navigation. This will happen with jQuery and it’s animation abilities. As such, the “magic line” will only be appended via JavaScript. Once added to the list and styled, as you mouse over the different links, it figures out the left positioning and the width and animates to match.

HTML

Typical list here…. It has the “group” class because it’s going to be a horizontal row and will need the clearfix so it has height. The ID is for the JavaScript to target it.

<div class="nav-wrap">
 <ul class="group" id="example-one">
    <li class="current_page_item"><a href="http://www.artisopensource.net/hacks/deliciouspoetry.php" title="del.icio.us poetry" >Home</a></li>
    <li><a href="http://www.artisopensource.net/hacks/deliciouspoetry.php" title="del.icio.us poetry" >Buy Tickets</a></li>
    <li><a href="http://www.artisopensource.net/hacks/deliciouspoetry.php" title="del.icio.us poetry" >Group Sales</a></li>
    <li><a href="http://www.artisopensource.net/hacks/deliciouspoetry.php" title="del.icio.us poetry" >Reviews</a></li>
    <li><a href="http://www.artisopensource.net/hacks/deliciouspoetry.php" title="del.icio.us poetry" >The Show</a></li>
    <li><a href="http://www.artisopensource.net/hacks/deliciouspoetry.php" title="del.icio.us poetry" >Videos</a></li>
    <li><a href="http://www.artisopensource.net/hacks/deliciouspoetry.php" title="del.icio.us poetry" >Photos</a></li>
    <li><a href="http://www.artisopensource.net/hacks/deliciouspoetry.php" title="del.icio.us poetry" >Magic Shop</a></li>
 </ul>
</div>

Notice the .nav-wrap div around it. That is used because of the styling, the bars go full width of the screen the but the navigation is centered within. This centering brings up an issue when we start the JavaScript.

CSS

Do the ol’ inline list elements with floated left anchors to get the list horizontal and avoid stairstepping. The magic line is absolutely positioned under the bar, so that it doesn’t cause jitter (mouse over a link, animates over, mouse is now on magic line not the link, animates back, etc.) Everything else is purely stylistic.

.nav-wrap { margin: 50px auto;  background-color: rgba(0,0,0,0.6); border-top: 2px solid white; border-bottom: 2px solid white; }
#example-one { margin: 0 auto; list-style: none; position: relative; width: 960px; }
#example-one li { display: inline; }
#example-one li a { color: #bbb; font-size: 14px; display: block; float: left; padding: 6px 10px 4px 10px; text-decoration: none; text-transform: uppercase; }
#example-one li a:hover { color: white; }
#magic-line { position: absolute; bottom: -2px; left: 0; width: 100px; height: 2px; background: #fe4902; }

jQuery JavaScript

  1. When DOM is ready…
  2. Set up variables including current left offset of the navigation
  3. Set up resize function on the window to reset that offset should it change (because of the centering)
  4. Append the magic line to the nav
  5. Set up position and width of the magic line for the current page item
  6. Also set the original width and position as data, so it can be used to animate back to
  7. On hover, calculate the new width and new left position and animate to it
  8. On the hover callback (mouse out), animate back to original
$(function(){
    var $el, leftPos, newWidth,
        $mainNav = $("#example-one"),
        pageOffset = $mainNav.offset().left;

    // Fixing the offset if the window changes size
    $(window).resize(function() {
        pageOffset = $mainNav.offset().left;
    });

    $mainNav.append("<li id='magic-line'></li>");
    var $magicLine = $("#magic-line");

    $magicLine
        .width($(".current_page_item").width())
        .css("left", $(".current_page_item a").offset().left - pageOffset)
        .data("origLeft", $magicLine.offset().left - pageOffset)
        .data("origWidth", $magicLine.width());

    $("#example-one li").find("a").hover(function() {
        $el = $(this);
        leftPos = $el.offset().left - pageOffset;
        newWidth = $el.parent().width();
        $magicLine.stop().animate({
            left: leftPos,
            width: newWidth
        });
    }, function() {
        $magicLine.stop().animate({
            left: $magicLine.data("origLeft"),
            width: $magicLine.data("origWidth")
        });
    });
});

Issues

Opera is weird about it. It makes the original width of the magic line the full width of the nav bar and shortens it from the right on hovers. I haven’t been able to figure it out. If you do, awesome, let me know I’ll update this article and demos.

Alternate Version

Check out the demo link below for an alternate version that uses a background instead of a line, and animates color as well as position and width. Basically the same, except the CSS is slightly different and the JavaScript pulls the color of the new list item from a rel attribute in the HTML.

Color animations in jQuery require the color plugin. I was just moaning about how it doesn’t work with RGBa color, and someone sent me a patch that does, which is included in the download. I’m really sorry, but I can’t remember their name! Speak up if it was you and I’ll update this and credit the patch to you.

All Yours

As always, feel free to do whatever you want with it. Preferably, use it in corporate projects and earn wheelbarrows of cash.

View Demo   Download Files

Responses

  1. G says:

    nothing new man…

  2. Hi Chris,
    You make this stuff so simple – thanks for all your great tips and hard work! My question is can this work with multi-level navigation as well? It wouldn’t need to apply the effect the the child links, but would like to be able to have them drop down. Any tips on this is helpful.

    Thanks, Larry

  3. Brandon says:

    Larry just asked the same question that I had as well. This is a great start, but what needs to happen to support multi-level navigation?

    • TeMc says:

      Though I haven’t tried it myself, one thing that might work is duplicate the code for the find(“a”) hover and make one for $(“li:not(:has(ul))”). that does the default stuff (it doesn’t have a UL-child so it’s not a dropdown-able item)

      And another one for $(“li:has(ul)”) that does have a ul-child. In that case move the magic line horizontally where it should be, but also move it down the height of the UL-element.

      If you dont want the magic line to move diagonally (ie. shortest route) then you need to queue the animation to go horizontal first to the LI-item, and then move vertically down (position: absolute; bottom: -(2 + UL-height)px; ). And on MouseOut (callback of hover() – move vertically up and then horizontally).

      I might try this next weekend, but I’m not sure I’ll remember. Feel free to see if it works out !


      TeMc

  4. Try looking into the dropdowns (also jQuery based):
    http://css-tricks.com/simple-jquery-dropdowns/

  5. Peter says:

    Thanks for sharing Chris, just a little detail. Download is broken.

  6. Once again, a sly implementation!

  7. Matt says:

    As always, feel free to do whatever you want with it. Preferably, use it in corporate projects and earn wheelbarrows of cash.

    Yes sir!

    Actually, I needed this for a commercial project as it was, and this just satisfied that need. You’re a 5-star helpful guy :)

  8. Daniele Pignedoli says:

    Wow, simply effect that looks pretty good.

    Just one thing, i prefer to have the magic-line li in the html markup, instead of appending it by javascript.

    Its just a matter of taste and probably your way is better for seo, but as a developer i love to see exactly the markup i’ll have to work with ;)

  9. How would you use this with Wordpress’ wp_page_menu?

Leave a Comment

Remember:
  • Be nice.
  • Wrap all (unescaped) code in <pre> and <code> tags. (single or multiple lines). Don't use <?php ?> tags.
  • You may use regular HTML stuff like <a href="">, <em>, and <strong>
http://codezine.jp/article/detail/4867
http://webdesignledger.com/freebies/20-different-and-beautiful-icon-sets
http://www.findsounds.com/
http://www.aedgency.com/

Aedgency - Performance-based Marketing


Welcome
to Aedgency

Your European performance
based marketing specialists
The Edge Method

We drive traffic
to your products.

We increase your revenue
Start a campaign

The offers consumers
are looking for

We serve them at the right time,
at the right place.
The era of offers

+ 14 million consumers across Europe

We reach them through
over 300 thematic channels.
Edge Channels

Caroline Williams - Marketing Aedgency

Cross your targets!

Did you know cross-targeting can increase the impact of your campaigns?
Learn all about this technique in our video tip of the month.
Check it out!



Aedgency Monthly Report

Sign up to receive it in your inbox!

http://flowingdata.com/2010/01/29/save-pens-use-garamond-font/
http://www.thebestdesigns.com/

Twitter Updates

Get Twitter updates when new websites or categories are added.

Featured Designers

Sponsored Links







Partners

Design Gallery

aperto.de
Added 1 day ago
Bold, Bright, Clean, Colorful, CSS, Photos, White

Sponsors

Hosted By

Dreamhost - Get $35 off when you sign up with the promo code AMR235.

Add Your Design Firm

Submit your portfolio or design firm to the Designers section to showcase your services.

Charities

Cooley's Anemia - In memory of Lisa Cammilleri.
Heather needs our help. Please take a moment to learn about Heather.

http://www.makeuseof.com/tag/5-sites-that-promote-internet-safety-for-kids
http://www.smashingmagazine.com/2010/02/08/color-theory-for-designer-part-3-creating-your-own-color-palettes/
http://www.dzone.com/links/index.html
http://www.soyouwanna.com/site/syws/marathon/marathon.html

SOYOUWANNA RUN A MARATHON?

So you're walking home, munching on a bag of chips, when all of a sudden a pack of bodies breezes by. Runners in training. You watch them glide ahead of you in awe - their toned muscles tightening and flexing as their feet hit the ground, their sweat glistening and running in rivets down their supple necks, their chests heaving… wait, wait, we're not that kind of website. That vision is enough, however, to make you toss the chips in the garbage and make a resolution: you must run a marathon.

Good for you! The benefits of marathon running include:

  • Increased energy
  • Improved health
  • A sense of accomplishment
  • Increased discipline
  • Quality time outdoors
  • A chance to show off to the opposite sex that you can do it
  • Of course, great-looking legs (Never underestimate the power of lean, muscular legs.)

This SYW will assume that you've never run a marathon before and that you're seeking explanations of some broad details of how to get started on the road to your physical and psychological salvation (cue "Chariots of Fire" background music). While you will not become a marathon runner overnight, you will notice weekly improvements if you follow our sage advice. Of course, there will also be times when you don't feel like you're improving at all. If that happens, remember to give it some time, you'll be rewarded in the end. Wow. We're almost better than Hallmark.

If you can't wait to break a sweat, skip the steps and check out this how-to video.

WATCH THIS HOW-TO RUN A MARATHON VIDEO

1. KNOW WHAT YOU'RE IN FOR

The definition of a marathon is a race that is 26.2 miles. To translate for all of you who are inept at math, it would take you nearly half an hour just to DRIVE that distance at 60mph, let alone run it. But don't despair; it actually isn't as difficult as it sounds (notice we didn't say that it's not painful…). You just need to approach it with the right attitude, one step at a time. Literally.

  • Ideally, you should expect to spend at least 26 weeks in training. Of course, this will vary depending on what shape you are in currently. It might take a bit longer if your idea of exercise is fetching a pop tart out of the toaster, and a bit less if you are regularly involved in some sort of fitness program.

  • Don't be intimidated by the idea of running a competitive marathon right away. Most people start out with 3 to 6 mile runs and work their way up. These races are often surrounded by a much less competitive atmosphere, and are a great way to get used to the feeling of running alongside tons of people. With a marathon as your ultimate goal, you can begin by "training through" (that's running lingo) these smaller runs.

  • Remember, we're talking about your body and your health here. As always when starting a vigorous exercise routine, you should consult with a physician beforehand. If you have a heart condition or weak knees, we suggest that you keep away from running and try something less vigorous. Like eating.

  • It's a good idea to do some serious research before you begin. If you know people who run, talk to them to find out what advice they have to give. If your friends look at you like you're crazy, then it's time to expand your social circle.

  • Find out what running clubs and organizations exist in your area. Many offer classes, which can be very helpful, as well as provide the safe option of running in groups. A site to help you do this, as well as locate coaches and trainers, is the Road Runners Club of America. Go to the "clubs" section to find your local chapter.
http://www.factmonster.com/spot/afroambios.html
Biographies

Notable African Americans

First Page
Back to Black History Month Page


Fact Monster™ Database, © 2007 Pearson Education, Inc. All rights reserved.

http://www.vancouver2010.com/
http://www.iphonewebdev.com/

iPhoneWebDev: Developers Helping Developers

Developing content for the hottest new mobile device? You’ve come to the right place.

This website is a community of web developers helping each other to create the best possible web applications for the iPhone... the premier platform for portable Web 2.0 applications.

Join the conversation!

Sign up for our public email discussion list hosted at Google Groups. Share your discoveries, tips and tricks, and learn what other developers have come up with.

Subscribe to the iPhoneWebDev List

But wait, there’s more...

Explore some examples of iPhone-specific layouts and tricks.

And check out our blog featuring in-depth looks at various aspects of iPhone-ready website and application development, as well as highlights from the email discussion list.

For more information, contact us.

http://www.facebook.com/pages/manage/promo_guidelines.php
 
 
 
 

You are using an incompatible web browser.

Sorry, we're not cool enough to support your browser. Please keep it real with one of the following browsers:

http://www.atmarkit.co.jp/fwcr/rensai/imasara16/imasara16_1.html
http://www.spiegel.de/netzwelt/web/0,1518,673441,00.html
https://www.memolio.com/
Already a Memolian? Sign in or Register!

No items in cart yet!

Create your memolio™ in 3 easy steps:
Upload 24 images
One at a time or select multiple images simultaneously. It's super easy!
Personalize
Choose theme color, image position
and add album description.
Preview online
Like what you see?
Save it, share it & order it!
Watch this short video demo that will show you all the basics of creating
a memolio™...
http://cannelle-vanille.blogspot.com/2008/01/arroz-con-leche.html
http://developer.apple.com/Mac/library/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/XHIGIntro.html#//apple_ref/doc/uid/TP30000894-TP6
Mac OS X Reference Library Apple Developer Connection spyglass button

Introduction to Apple Human Interface Guidelines

Apple has the world’s most advanced operating system, Mac OS X, which combines a powerful core foundation with a compelling user interface called Aqua. With advanced features and an aesthetically refined use of color, transparency, and animation, Mac OS X makes computing even easier for new users, while providing the productivity that professional users have come to expect of the Macintosh. The user interface features, behaviors, and appearances deliver a well-organized and cohesive user experience available to all applications developed for Mac OS X.

These guidelines are designed to assist you in developing products that provide Mac OS X users with a consistent visual and behavioral experience across applications and the operating system. Following the guidelines is to your advantage because:

The implementation of Apple’s human interface principles make the Macintosh what it is: intuitive, friendly, elegant, and powerful.

What Are the Apple Human Interface Guidelines?

This document is the primary user interface documentation for Mac OS X. It provides specific details about designing for Aqua compliance in Mac OS X version 10.6, although some of the information may apply to previous versions of Mac OS X.

Aqua is the overall appearance and behavior of Mac OS X. Aqua defines the standard appearance of specific user interface components such as windows, menus, and controls, and is also characterized by the anti-aliased appearance of text and graphics, shadowing, transparency, and careful use of color. Aqua delivers standardized consistent behaviors and promotes clear communication of status through animated notifications, visual effects, and more. Designing for Aqua compliance will ensure you provide the best possible user experience for your customers.

Aqua is available to Cocoa, Carbon, and Java software. For Cocoa and Carbon application development, Interface Builder is the best way to begin building an Aqua-compliant graphical user interface. If you are porting an existing Mac OS 9 application to Mac OS X, see the Carbon Porting Guide. Java developers can use the Swing toolkit, which includes an Aqua look and feel in Mac OS X.

Who Should Read This Document?

Anyone building applications for Mac OS X should read and become familiar with the contents of this document. This document combines information on the mechanics of designing a great user interface with fundamental software design principles and information on leveraging Mac OS X technologies.

Organization of This Document

The document is divided into three main parts, each of which contains several chapters:

Supplementary information is provided in the following locations:

Conventions Used in This Document

Throughout this document, certain conventions are used to provide additional information:

Some of the example images include visual cues to note whether a particular implementation is appropriate or not:

Bold text indicates that a new term is being defined and that a definition of the word or phrase appears in the glossary.

Apple developer documentation is available from the Reference Library on the Apple Developer Connection (ADC) website:

http://developer.apple.com/referencelibrary/

In this document, cross-references to Apple documents look like this:

See Accessibility Overview.

Cross-references to API reference documentation on specific methods or classes look like this:

See NSButton.

See Also

To get an overview of the technologies available in Mac OS X, you should read Mac OS X Technology Overview.

The Apple Developer Connection Reference Library website at http://developer.apple.com/referencelibrary/ has links to API reference and conceptual documentation for many of the topics discussed in this book.

If you are using Xcode, you can peruse the Reference Library without leaving the Xcode development environment. In the Xcode Help menu, choose Documentation to open a document-viewing window. (For more information about using Xcode, see Xcode User Guide.)

The Apple Developer Connection User Experience website at http://developer.apple.com/ue contains regularly updated information about user experience design for Mac OS X.

The Apple Publications Style Guide provides information helpful for choosing the correct language and terminology to use throughout your application in text displays and dialogs as well as your documentation.

To receive notification of updates to this document and others, you can sign up for Apple Developer Connection’s free Online Program and receive the weekly ADC News email newsletter. For more details about the Online Program, see http://developer.apple.com/membership.



Last updated: 2009-08-20

Did this document help you? Yes It's good, but... Not helpful...
http://www.sequelpro.com/
Best Looking MySQL Cocoa App.
Sequel Pro is a fast, easy-to-use Mac database management application for working with MySQL databases.
Flexible Connectivity.
Sequel Pro gives you direct access to your MySQL databases on local and remote servers.
Perfect Web Development Companion.
Whether you are a Mac Web Developer, Programmer or Software Developer your workflow will be streamlined with a native Mac OS X application!

What's coming next?
Our next major milestone is a 1.0 release* which should contain improved printing support, an export dialogue redesign, contextual menus, user management and lots of other goodies.
* — Features may change before the 1.0 release.

Loveable App

  • Easily set up a connection to the local MySQL server on your Mac
  • Full table management including indexes
  • Support for MySQL Views
  • Use multiple windows to work with multiple databases/tables at once

Powerful Query Editor

  • Automatic Syntax highlighting for your custom queries
  • Customisable query editor font
  • Popular text editor features built right in
  • Auto-completion of keywords, table names and field names

Amazing Compatibility

  • Support for almost 30 different encoding options
  • Compatible with MySQL 3, 4 and 5 databases
  • Quick Export/Backup with SQL/CSV files
  • Fast Import/Restore of SQL/CSV files


Get Answers
Check out our brand new docs wiki or see what other users are talking about in the Google Group discussions.
Following Sequel Pro
Sign up to the Sequel Pro Blog Feed and we'll keep you posted with all the latest developments.
Always up to date
Download a Sequel Pro nightly build and you will get all the new features before they go prime-time.
Get Involved
If you find a bug in the Sequel Pro app, check the Issue Tracker to see if the bug has been reported already.

http://well-formed-data.net/
http://www.debian.org/doc/debian-policy/index.html#contents


[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ next ]


Debian Policy Manual


Abstract

This manual describes the policy requirements for the Debian GNU/Linux distribution. This includes the structure and contents of the Debian archive and several design issues of the operating system, as well as technical requirements that each package must satisfy to be included in the distribution.


Copyright Notice

Copyright © 1996,1997,1998 Ian Jackson and Christian Schwarz.

These are the copyright dates of the original Policy manual. Since then, this manual has been updated by many others. No comprehensive collection of copyright notices for subsequent work exists.

This manual is free software; you may redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.

A copy of the GNU General Public License is available as /usr/share/common-licenses/GPL in the Debian GNU/Linux distribution or on the World Wide Web at the GNU General Public Licence. You can also obtain it by writing to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.


Contents


[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ A ] [ B ] [ C ] [ D ] [ E ] [ F ] [ G ] [ next ]


Debian Policy Manual

version 3.8.4.0, 2010-01-27

The Debian Policy Mailing List


http://www.highcharts.com/demo/

Highcharts Demo Gallery

« Go to the Highcharts home page

Pick an example on the left and combine it with a preset theme in the top menu. Click "View options" to inspect the code.

Line and scatter charts

Area charts

Column and bar charts

Pie charts

Combinations




View options
var chart = new Highcharts.Chart({
   chart: {
      renderTo: 'container',
      defaultSeriesType: 'line',
      margin: [50, 150, 60, 80]
   },
   title: {
      text: 'Monthly Average Temperature',
      style: {
         margin: '10px 100px 0 0' // center it
      }
   },
   subtitle: {
      text: 'Source: WorldClimate.com',
      style: {
         margin: '0 100px 0 0' // center it
      }
   },
   xAxis: {
      categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
         'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
      title: {
         text: 'Month'
      }
   },
   yAxis: {
      title: {
         text: 'Temperature (°C)'
      },
      plotLines: [{
         value: 0,
         width: 1,
         color: '#808080'
      }]
   },
   tooltip: {
      formatter: function() {
                return '<b>'+ this.series.name +'</b><br/>'+
            this.x +': '+ this.y +'°C';
      }
   },
   legend: {
      layout: 'vertical',
      style: {
         left: 'auto',
         bottom: 'auto',
         right: '10px',
         top: '100px'
      }
   },
   series: [{
      name: 'Tokyo',
      data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
      //dataURL: 'tokyo.json' 

   }, {
      name: 'New York',
      data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]
   }, {
      name: 'Berlin',
      data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]
   }, {
      name: 'London',
      data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
   }]
});

« Previous Next »
http://hivelogic.com/articles/top-10-programming-fonts
http://cluborlov.blogspot.com/
http://webdev.stephband.info/parallax.html

jParallax

Download

jParallax has had a major overhaul in readiness to be released as version 1.0! Layers are now freezable – the last feature I wanted to implement – and the code is more j and compact. I've been really encouraged by all the great comments, so thank you everyone! I just need you to road test the demos and tell me that it's still working in your browser, and then I'll stick a 1.0 on it.

Cheers!

What does jParallax do?

Diagram of parallax layers.

jParallax turns a selected element into a 'window', or viewport, and all its children into absolutely positioned layers that can be seen through the viewport. These layers move in response to the mouse, and, depending on their dimensions (and options for layer initialisation), they move by different amounts, in a parallaxy kind of way.

The diagram on the right illustrates what Parallax does to the html:

<ul id="parallax">
  <li></li>
  <li></li>
</ul>

Here's a demonstration with some images:

But that's not all that jParallax does. If the layers are made of <div>s or <li>s or any other container then content can be positioned inside those layers, and Parallax provides methods for navigating to that content in response to user events.

Demos

Using jParallax

The default behaviour of jParallax is to show the whole width of a layer in response to the mouse travelling the whole width of the parallax 'window'. When the mouse is moved to the extreme left-hand side of the parallaxed window the left-hand side of the layer meets it, and when the mouse is moved to the extreme right-hand side of the parallaxed window the right-hand side of the layer arrives at the right hand-side of the window.

The simplest way to use jParallax is to make the layers different sizes using CSS. Bigger layers move faster and thus appear closer, and unless a layer is smaller than the viewport, its edges are never seen. The Colour Drops Demo was made in exactly this way, with jParallax in its default state, and the 'speed' of the layers controlled simply by making the images different sizes. No options have been passed in.

However, we all want tweaky-tweaky. I also give you tweaky-tweaky...

Instantiation

jQuery('#parallax').jparallax(options, layer_options);

Clearly the parallaxed element(s) can be selected any way you like. For the sake of simplicity for the rest of this guide I refer to the parallaxed element as '#parallax'.

CSS

In most cases, you should set the following CSS on the parallaxed element:

#parallax
    {position:relative; overflow:hidden; width:npx; height:npx;}

Children of a parallaxed element become layers, and are automatically given position:absolute; in order to start moving them around, but the parallaxed element itself needs position:relative; or position:absolute; or the layers will move relative to the document rather than the viewport. overflow:hidden; stops layers displaying outside of the bounds of the viewport, and width and height should be set to prevent the viewport collapsing.

In addition, jParallax needs to know how big layers are, and if there is anchored content inside a layer it needs to know where and how big it is. It uses jQuery's height(), width() and offset() methods to find out. However, if you experience trouble with the range of motion of a layer you should consider setting all dimensions (height, width, top and left) explicitly via CSS to make life easy for those methods.

Options default values

The following options can be passed to jParallax to set the behaviour of the mouse, default behaviour of the layers, animation settings and so on:

mouseResponse: boolean true
mouseport: jQuery('element') same as parallaxed element
Enables mouse response and specifies the DOM element to track the mouse in. By default it's on, and it's the same as the viewport, the DOM element that you instantiated jParallax on. Perhaps you might want to use the whole window as the mouseport, in which case you could pass in jQuery(window).
mouseActiveOutside: boolean false
Enables mouse response outside the limits of the mouseport, but layers behave as if the mouse was at the edge of the mouseport.
linkResponse: boolean true
Enables response to "link" events triggered on the parallaxed element(s). Content containing an anchor tag, and positioned inside a layer, is pulled to the centre of the viewport when the anchor's name attribute is passed as the first value in an array via the custom "link" event. Consider the following code:
jQuery('a').click(function(){
      var ref=jQuery(this).attr("href");
      jQuery('#parallax').trigger("link", [ref]);
      });
This says that when an anchor in the document is clicked, its html attribute will be passed as a ref to the element '#parallax' in a "link" event trigger. If there is content on one of the layers containing <a name="ref"> it will be pulled to the centre of the viewport. If not, nothing will happen.
If linked content is not being used it's a good idea to switch linkResponse to false. It will save the browser a tiny amount of overhead on plugin initialisation. This option was called "triggerResponse" up to version 0.9.9.
linkExposesEdges: boolean false
Sets whether linkResponse pulls the edges of layers into the viewport while attempting to display content in the centre.
takeoverFactor: 0-1 0.68
takeoverThresh: 0-1 0.002
Sets the speed and accuracy with which the layers 'catch up' with the mouse position when the mouse enters the mouseport from somewhere other from whence it has left. Technically, takeoverFactor is the decay of the approach curve per animation frame, where lower numbers are more decay (and therefore quicker), and takeoverThresh is the distance within which the layer position is considered to have arrived, as a ratio of the mouseport dimension. takeoverThresh is by default a five-hundredth of the mouseport - larger numbers may produce a noticeable 'jump' at the beginning of a new mouse movement. You shouldn't need to mess with these too much, I just stuck them in there because we all like tweaky-tweaky.
frameDuration: milliseconds 25
You may want to put this up to save CPU. About 40 is acceptable (25 frames/second). I like it zippy, though. I hear Google Chrome has got timing accuracy down to 1ms! Others don't do lower than 15ms.
xparallax: boolean true
yparallax: boolean true
xorigin: 'left' | 'centre', 'center', 'middle' | 'right' | 0-1 'centre'
yorigin: 'top' | 'centre', 'center', 'middle' | 'bottom' | 0-1 'centre'
Sets default alignment of layers. See 'Layer Options' below for a detailed description.
cssViewport: {name: value} {}
cssLayers: {name: value} {position: absolute}
Style jParallax via jQuery on instantiation. This can make sense when you start thinking about graceful degredation. I don't recommend it to start with, though.

Layer Options default values

In addition to the options above, Layer Options can be passed to each layer individually, as extra arguments:

jQuery('element').jparallax(options, layer_0_options, layer_1_options, etc.);

As an example, to give the second layer a set xtravel value, but pass no options as default:

jQuery('element').jparallax({}, {}, {xtravel: '200px'});

A layer option object can have the following parameters:

xparallax: boolean true
yparallax: boolean true
Enables motion in the x or y direction in response to the mouse.
xtravel: 0-1 | 'n%' | 'npx' 1
ytravel: 0-1 | 'n%' | 'npx' 1
When specified as a number between 0 and 1, or as a percentage string, xtravel and ytravel scale the distance a layer will travel. When specified as a pixel string they set the distance a layer will travel.
When travel is left at the default 1, the behaviour is to display the whole width of the layer over the whole range of the viewport in response to the mouse travelling the whole width of the mouseport. In other words, the left meets the left when the mouse is on the left, the centre lines up when the mouse is at the centre and the right meets the right when the mouse is at the right. Setting xtravel to, say, 0.5, or '50%' will mean half that layer's possible horizontal travel will occur over the same range of mouse motion.

Numbers outside the range 0-1 can be used, too. Negatives will cause travel in reverse direction, scaling factors greater than 1 (or '100%'), or less than -1 (or '-100%') will cause the edges of layers to be pulled into view.
xorigin: 'left' | 'centre', 'center', 'middle' | 'right' | 0-1 'centre'
yorigin: 'top' | 'centre', 'center', 'middle' | 'bottom' | 0-1 'centre'
Only meaningful when xtravel or ytravel are not 1. Determines which point of the layer lines up with which point of the viewport when the mouse is at that point in the mouseport. Got that?

Look, if origin.x is set to 'left', then when the mouse is moved to the left hand side of the mouseport the left hand side of the layer arrives at the left hand side of the viewport. If it's set to 'centre', then when the mouse is at the centre of the mouseport the centre of the layer is aligned with the centre of the viewport. Similarly with 'right'.

Numbers may also be used:
  • 0 is equivalent to 'left'.
  • 0.5 is equivalent to 'centre' or 'center' or 'middle'.
  • 1 is equivalent to 'right'.
Numbers outside the range 0-1 may also be used, although you will start seeing the edges of layers appearing inside the viewport. And they'll travel in the opposite direction.

width: integer undefined
height: integer undefined
Values for layer dimensions, normally read from css, can be overridden. This does NOT change the css, only jParallax's idea of how big a layer is. This can be very useful in cases where you want to be able to 'click through' the upper layers. Typically you make layers very small in css, but tell jParallax they are big via width and height. You prabably want overflow: visible on those layers, too.

Tips

Extra graphics

If you want to add elements to #parallax, such as overlaying curved corner images like in the above example, add them after you have instantiated jParallax in order to avoid having those elements included in the calculations.

Transparent image layers

Use jQuery iFixPng plugin, to make see-through .png images work on IE6.

Sites using jParallax

Let me know if you have a site that uses jParallax using the 'Write to me' form at the top of this page.

Version history

0.9.9

Basically version 1.0, but until I've fully tested it, it's staying 1% away.

0.9.1

0.9

0.8.1

0.8

0.7 (Not released)

0.6

0.5

0.4

0.3

0.2

0.1

Write to me Buy me a beer!
http://www.telc.net/
Branding Home

UNSER BEITRAG ZUR INTEGRATION

telc unterstützt Migranten mit dem Deutsch-Test für Zuwanderer A2 / B1 bei der Integration in Deutschland. Das neue Testformat bietet wichtige Vorteile.  mehr

UNSER BEITRAG ZUR INTEGRATION

Wer für ein Visum einfache Deutschkenntnisse nachweisen muss, kann bei den Visastellen das Zertifikat Start Deutsch 1 / telc Deutsch A1 vorlegen. mehr

TELC SPRACHPRÜFUNGEN

$headertext

Januar 2010

Kommunikationsoffensive "Mehrsprachigkeit und Integration"

Mit prominenten Botschaftern für Mehrsprachigkeit feierte telc den Auftakt der neuen Kampagne…mehr


Januar 2010

Neue telc Spanischprüfung für Jugendliche

Spanisch wird als zweite oder dritte Fremdsprache bei jungen Leuten immer beliebter...mehr


http://www.bestcollegesonline.net/blog/2010/25-eye-popping-optical-illusions/