Recent Notes

Displaying keyword search results 21 - 30
Created by James on March 02, 2011 12:29:38    Last update: March 11, 2011 08:42:50
jQuery event delegation allows you to bind event handlers to elements not yet created, under these conditions: The DOM element must nest inside the element to which the event is delegated to The inner element must not stop event bubbling The opposite of delegate is undelegate . <!DOCTYPE HTML> <html> <head> <title>jQu...
Created by Dr. Xi on February 25, 2011 08:43:40    Last update: February 28, 2011 11:16:10
If you think the JavaScript code below is simple, think again. Try it in different browsers and see if you can explain what you see. What is displayed in the browser window with this HTML page? <!doctype html> <html> <body> <p>befor... What is displayed inside the iframe? Try different browsers. <!doctype html> <html> <head> <style t...
Created by Dr. Xi on August 31, 2008 20:43:44    Last update: January 22, 2011 12:48:08
It's probably more useful to make the JavaScript executor a bookmarklet. That way it gains access to the page on which it is invoked. Therefore, more helpful while debugging. Here's the code: <html> <body> <a href="javascript:(funct... Or, you can add this link to your bookmarks, name it "JS Executor". For a full featured JavaScript console, you may need Jash
Created by James on July 04, 2009 16:30:40    Last update: January 11, 2011 21:21:59
If you are looking for a solution for a progress bar, I direct you to the following resources: Bare Naked App provides a simple and elegant solution based on pure CSS with two images. You control the percentage of completion through the background-position attribute of the CSS. HTML: <img src="/images/percentImage.png" alt="... CSS: img.percentImage { background: white url(/imag... Images: (percentImage.png) (percentImage_back.png) WebAppers extended the above solution with JavaScript. They also added several colored images: JQuery UI has a built-in progress bar widget. However, if you want to get to understand some of the foobar needed to get CSS to work (in general) through this example, stay with me for the rest of this note. Initially I was thinking, a progress bar should be easy: just make...
Created by James on October 11, 2010 19:01:28    Last update: January 11, 2011 20:38:56
Test page (click the "new window" icon to see the transition): <!DOCTYPE html> <html> <head> <title>jQu...
Created by James on October 11, 2010 18:14:41    Last update: January 11, 2011 20:36:01
Test page: <!DOCTYPE html> <html> <head> <title>jQu... Documentation: UI/Effects - jQuery JavaScript Library Effects - jQueryAPI
Created by James on September 28, 2010 18:57:58    Last update: January 11, 2011 20:35:02
Test page to demo that preventDefault works perfectly for a text input but fails for select , even though the event is cancelable: <!DOCTYPE html> <html> <head> <title>Pre...
Created by James on September 07, 2010 03:11:39    Last update: January 11, 2011 20:28:33
I didn't know how hard it was to vertically align something to the middle until I had to do it. An excellent writeup about the various techniques (or should I say hacks?) to achieve this is here: http://blog.themeforest.net/tutorials/vertical-centering-with-css/ Here I present a technique with the help of jQuery. To make it simple, what I'm doing is to display a single line of text in the middle of the page instead of at the top. The markup is made simple because the logic is moved to JavaScript. There are two requirements to make this work: The parent container uses relative positioning jQuery code added to re-position the content with absolute positioning <!doctype html> <html> <head> <title>Vert... For some reason, the following code did not work although...
Created by James on June 22, 2010 18:46:31    Last update: January 11, 2011 20:24:42
This is the page: <!DOCTYPE html> <html> <head> <title>jQu... It renders like this in IE 7: However, when you try to scroll to the bottom of the dialog, IE takes long time to respond, the it messes up the title bar: Everything works fine if you take away the relative position in CSS: <style type="text/css"> #dialog .input { ...
Created by James on September 03, 2010 15:52:12    Last update: January 11, 2011 20:22:40
Use the siblings function to find all siblings of the current jQuery object: $(this).siblings() which is equivalent to: $(this).parent().children().not(this) Or, use an optional selector to further limit the selection of siblings: $(this).siblings('li .hilighted') Test page: <!DOCTYPE html> <html> <head> <title>jQu...
Previous  1 2 3 4 5 Next