Posts Tagged ‘jquery’

jQuery selector and its element order

Posted in XHTML / JavaScript / CSS on June 15th, 2009 by Thomas – Be the first to comment

This issue applies to jQuery 1.2.6. It might have been fixed in later versions.
I experienced this in a script where I made a selection of list-elements allocated in a variable that I wanted to work with. I used hide(), and show() and the selector :first and :last. When I hide and then showed an element it suddenly moved to the end of the list when it originally was at the beginning of the list. When I then used :first to point to the first element, I got the second because it had moved. To solve this I had to do the selection over again instead of using the variable holding the selection. So don’t use a variable to hold your selection when you want to use :first and :last. Do a new selection instead.

Manipulating opacity during animation with jQuery and its effects in IE

Posted in Miscellaneous, XHTML / JavaScript / CSS on May 28th, 2009 by Thomas – Be the first to comment

Changing opacity on an element dynamical with jQuery often gives strange and unwanted effects in IE. It depends on the sites structure and css. It normally appears after an element has been faded out, and is faded in again. Text colour disappears, backgrounds looks strange opacity is wrong. Several things can happen.

read more »

Embedding Flash without messing up the HTML fall back

Posted in XHTML / JavaScript / CSS on April 1st, 2009 by Erland – Be the first to comment

Sometimes we need to insert a 100% Flash into a page. This little snippet shows you how you can achieve it without breaking the normal browser behavior (scrollbars etc) for users viewing the retro HTML fall back.

Prerequisites: jQuery and swfobject 2.

read more »

How to send metadata in header when using jQuery

Posted in XHTML / JavaScript / CSS on April 1st, 2009 by Thomas – Be the first to comment

Sometimes when working with Ajax one needs to send some metadata in addition to the normal response.

This is usually the case when the response is HTML or text and is quite common in other libraries, like prototype.

The problem in jQuery is that one can only access the response and status in the callback function “success”.

This is easily altered, but it must be done in the library itself.

read more »

Delay in jQuery

Posted in XHTML / JavaScript / CSS on April 1st, 2009 by Thomas – Be the first to comment

The jQuery library in comperison with the prototype library, do not contain a delay function.
If you work with animations and effects the jQuery FxQueues plugin will be useful.

jQuery FxQueues plugin expands the animation and effect functions with following options:

  • queue: (string) Name of the queue. If it doesn’t exist, it creates the new queue. If you pass false no queue is created.
  • scope: (string) Name of the scope.
  • position: (”front”|”end”) Queue position where animation (or scope, if passed) is queued.
  • preDelay: (int) Milliseconds to wait before starting the next in queue.
  • postDelay: (int) Milliseconds to wait after finishing the animation.

read more »