Notes by James
Displaying notes 81 - 90
Created by James on October 19, 2010 23:03:16
Last update: October 19, 2010 23:08:03
Name License
JavaScript InfoVis Toolkit New BSD License
flot - Attractive JavaScript plotting for jQuery MIT License
PlotKit - Javascript Chart Plotting New BSD License
Raphaël—JavaScript Library MIT License
gRaphaël—JavaScript Library MIT License
Created by James on October 15, 2010 20:10:26
Last update: October 15, 2010 20:10:26
Download the Cufon Javascript and save it as cufon-yui.js .
Generate the font JavaScript and save it as myfont.js (upload the font file through http://cufon.shoqolate.com/generate/ ).
Add these lines to the header element:
<script type="text/javascript" src="cufon-yui.js">...
Replace selected elements with JavaScript like this:
<script type="text/javascript">
Cufon.rep...
Full HTML page:
<!DOCTYPE html>
<html>
<head>
<title>C...
Reference: Cufonize Your Pages – How to add Cufon to your Web Design
Created by James on October 13, 2010 18:16:08
Last update: October 13, 2010 18:16:08
From jQuery doc :
The .data() method allows us to attach data of any type to DOM elements in a way that is safe from circular references and therefore from memory leaks.
We can set several distinct values for a single element and retrieve them later:
$('body').data('foo', 52);
$('body').data('bar'...
It must be emphasized that the data is associated with the DOM object, not the jQuery object:
var a = $('div label');
var b = $('div label');...
The above usage is just a shorthand for jQuery.data(domElement, key) .
Created by James on October 12, 2010 16:17:05
Last update: October 12, 2010 16:18:31
The splice method cuts elements from an array, and returns the cut-off elements as a new array.
a = [1, 2, 3, 4, 5, 6, 7];
b = a.splice(1, ...
Created by James on October 12, 2010 15:48:29
Last update: October 12, 2010 15:48:29
The pop method removes an element from the end of an array; the shift method removes an element from the beginning of an array:
a = [1, 2, 3, 4];
a.pop(); // 4
a.shift(); /...
Created by James on October 07, 2010 21:30:26
Last update: October 07, 2010 21:30:26
To select all elements with both class1 and class2 :
$('.class1.class2'); // with no space between clas...
To select all elements with class1 or class2 , use the jQuery multiple selector :
$('class1, class2'); // with a comma in between
Created by James on October 06, 2010 20:54:39
Last update: October 06, 2010 20:55:00
When a JavaScript call is taking too much time, Firefox pops up this message: Of course the solution is to speed up your script. But suppose it really needs to exceed the preset timeout, you can delay the popup by following these steps: Enter about:config in the address bar Ignore the warning and proceed Enter dom.max_chrom in the filter input Change the value of dom.max_chrome_script_run_time to a bigger value (default is 20). For IE, there's a similar dialog with this message: "A script on this page is causing Internet Explorer to run slowly". But rather than counting elapsed time, IE counts the number of statements executed , which is controlled by the registry key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Styles . You need to create a DWORD value named...
Created by James on October 02, 2010 20:15:20
Last update: October 02, 2010 20:15:20
Some JavaScript utilities to popup images.
colorbox : jQuery 1.3/1.4 plugin, MIT License
Fancybox : jQuery plugin, MIT and GPL licenses
Shadowbox.js : "Free from Frameworks", Shadowbox.js License (free for non-commercial use)
Created by James on September 28, 2010 23:17:16
Last update: September 28, 2010 23:17:16
Use the attr function to set and clear a checkbox:
check checkbox
$('input [name=cb] ').attr('checked', true);
uncheck checkbox
$('input [name=cb] ').attr('checked', false);
Created by James on September 28, 2010 22:14:40
Last update: September 28, 2010 22:14:40
Use the is function to check if a jQuery object is visible:
$('div.log-data:first').is(':visible')