Colin

Posted on Saturday, May 15, 2010

Overcoming live() events and stopPropagation

As long as the parent element detect that the event was triggered by an anchor, it stop executing.

This is a method to replace stopPropagation() function which doesn't work in live() events.

$('body').live('click', function(e) {
// bail out if this event was triggered by an anchor
if ( $(e.target).is('a') ) { return; }

// do cool stuff down here
});

Source: http://forum.jquery.com/topic/overcoming-limitations-of-live-events-and-stoppropagation

Labels: ,

Posted on Friday, January 29, 2010

jQuery Animation: Queue, Stop()

When ".stop()" is used, all specified elements will stop their animation immediately and allow the next queued up animation to execute.

$('li').stop().animate({...code....});

By inserting "queue : false", we can stop the animation from queuing up in the animation buffer.

$('li').animate({...code...},{queue:false},1000);

To combine usage for both methods,

$('li').stop(true).animate({...code...});


Reference Website:
http://tutsvalley.com/tutorials/making-a-cool-thumbnail-effect-with-zoom-and-sliding-captions
http://www.netiblog.com/programming/jquery/turning-off-the-jquery-animation-queue

Labels: , , ,

Posted on Thursday, November 19, 2009

Simple IE6 Hack/ Fix Cheat Sheet

This is a very basic guide for IE6 fixes/hacks. Do not try to attempt to understand why IE works in such mysterious way. Just copy and paste. Be happy.



Problem:
Incomplete/ Disappearing Borders

Solution:
Add in the property "position:relative" to the containing div

OR

Add in the property"overflow:auto;width:100%;"




Problem:
min-width

Solution:

width: expression(document.body.clientWidth <> 1279? "1000px" : "auto");

In human language: If screen resolution width less than 1024, change width to 800px. If screen resolution width greater than 1279, change width to 1000px;





Problem:
No padding-top nor padding-bottom for anchors(links)

Solution:
Add property "display:block" to the anchors





Problems:
Floating elements causes divs below it to cluster-fuck with them

Solution:
Stuff "clear:both" up those div's nose

Labels: , ,

Posted on Sunday, November 8, 2009

Swine flu had struck Fairy Tale land!


Poor piglet~~

Labels: , ,

Posted on Thursday, November 5, 2009

Hierarchy of a Programming family

private void family(){

Father:
Charlie C
Daughter: Montana Perl, Bianca Java, C#
Son: Vin C++
Grand-daughters: Jessica Groovy, Jane Scala (Both daughter of Java)

}

public void friends(){

Pierson PHP(Java's best pal), Angelina Ruby (Groovy's buddy)

}

public boolean checkTwins(){
Mary JavaScript != Java;
}

public static String mrReliable(){

return "Jack Python";

}

Get the full low-down on the history and relationship between them over here: If Programming Languages Were Real Persons

Labels: ,

Posted on Wednesday, November 4, 2009

Go Home IE6!


Done by Robot Johnny. This picture is shown as a denial message to IE6 users who had chance upon momentile.com. There is also a little message included in the css file

  "This is not being lazy. Momentile is for entertainment and I just can’t justify taking the time to hack my way to IE6 glory for a user that is too lazy to upgrade their browser. It’s time to push back."

Labels: ,

Posted on Monday, November 2, 2009

Lightbox testing

Labels: