etter CSS. To nitpick, I'd say that warnings like "Don't use ID selectors" is a bit harsh and biased toward Nicole's own OOCSS style, but hey, it's her creation. The project is on GitHub, so if you find errors or want to make your own…


Advertise here with BSA

CSS Lint is a post from CSS-Tricks

]]> //AN_Xml: New tool by Nicholas Zakas and Nicole Sullivan to analyze your CSS and tell you that you are doing a bad job. It's an amazing tool to help you understand how to write better CSS. To nitpick, I'd say that warnings like "Don't use ID selectors" is a bit harsh and biased toward Nicole's own OOCSS style, but hey, it's her creation. The project is on GitHub, so if you find errors or want to make your own version, do it up there.

//AN_Xml:

Direct Link to ArticlePermalink


Advertise here with BSA

CSS Lint is a post from CSS-Tricks

]]>
//AN_Xml: http://css-tricks.com/9758-css-lint/feed/ //AN_Xml: 0 //AN_Xml: //AN_Xml: //AN_Xml: Just One Of Those Things You Need To Understand About JavaScript //AN_Xml: http://css-tricks.com/9738-just-one-of-those-things-you-need-to-understand-about-javascript/ //AN_Xml: http://css-tricks.com/9738-just-one-of-those-things-you-need-to-understand-about-javascript/#comments //AN_Xml: Wed, 15 Jun 2011 12:00:47 +0000 //AN_Xml: Chris Coyier //AN_Xml: //AN_Xml: //AN_Xml: http://css-tricks.com/?p=9738 //AN_Xml:

Ever since I've published the article Dynamic Page / Replacing Content, I've gotten quite a few emails that come in from people who are trying to use it in conjunction with some other JavaScript stuff and having trouble. Most of the time, it's some kind of lightbox effect. One of their pages has a bunch of thumbnails on it, and when they load that page in, the lightbox effect doesn't work.

//AN_Xml:

The problem is that when the thumbnails are…


Advertise here with BSA

Just One Of Those Things You Need To Understand About JavaScript is a post from CSS-Tricks

]]>
//AN_Xml: Ever since I've published the article Dynamic Page / Replacing Content, I've gotten quite a few emails that come in from people who are trying to use it in conjunction with some other JavaScript stuff and having trouble. Most of the time, it's some kind of lightbox effect. One of their pages has a bunch of thumbnails on it, and when they load that page in, the lightbox effect doesn't work.

//AN_Xml:

The problem is that when the thumbnails are loaded onto the page (via Ajax, i.e. jQuery's .load() function) they do not have any events bound to them.

//AN_Xml:
/* Your lightbox plugin */
//AN_Xml:$("photos a").ceebox();  
//AN_Xml:
//AN_Xml:/* Basics of Ajax */
//AN_Xml:$("nav a").click(function(e) {
//AN_Xml:    e.preventDefault();
//AN_Xml:    $("#main-content").load(this.href);  /* Thumbnails loaded from here */
//AN_Xml:});
//AN_Xml:

The way that the lightbox plugin (probably) works is that it binds click events to the elements you passed in that selector (the thumbnails) when the page loads, and those click events do the lightbox action. Since the newly loaded thumbnails have no click event, the lightbox action does't work.

//AN_Xml:

One way to fix it is to call the lightbox plugin after the content loads, in the callback function of the load function:

//AN_Xml:
$("photos a").ceebox();  
//AN_Xml:
//AN_Xml:$("nav a").click(function(e) {
//AN_Xml:    e.preventDefault();
//AN_Xml:    $("#main-content").load(this.href, function() {
//AN_Xml:
//AN_Xml:              /* Callback function */
//AN_Xml:              $("photos a").ceebox();  /* Call this again */
//AN_Xml:
//AN_Xml:    });
//AN_Xml:});
//AN_Xml:

A little repetitive, but that'll do the trick.

//AN_Xml:

A Better Way with Delegate

//AN_Xml:

While this is "just how JavaScript works" it's a known pain in the butt. Since jQuery is a library that exists to ease pains like this, of course it has a better way. That way is the .delegate() function, where instead of binding events to the individual elements, you bind an event to an element higher up the DOM tree, which isn't likely to be replaced via Ajax, which watches for those clicks.

//AN_Xml:

This relies on something called event bubbling, which is a neat and important concept in JavaScript (really: the DOM model). If you click on a thumbnail, it will trigger a click event on that element, then a click event on it's parent element, and a click event on it's parent's parent element, all the way up to the root element. Because of this, we can watch for clicks on deeper-down elements from higher-up elements.

//AN_Xml:

Unfortunately with our lightbox example, you would have to alter the plugin itself to get it to use delegate instead of binding directly to the elements. Definitely do-able but trickier, since you probably aren't as intimately familiar with that plugin's code as you are your own.

//AN_Xml:

Listen to Remy Sharp

//AN_Xml:

As this article was drafting, Remy Sharp put out a video screencast about this exact topic. He's way better at explaining it than me, so please go watch that.

//AN_Xml:

Advertise here with BSA

Just One Of Those Things You Need To Understand About JavaScript is a post from CSS-Tricks

]]>
//AN_Xml: http://css-tricks.com/9738-just-one-of-those-things-you-need-to-understand-about-javascript/feed/ //AN_Xml: 26 //AN_Xml:
//AN_Xml: //AN_Xml: The Stats That Matter: Your Site’s Stats //AN_Xml: http://css-tricks.com/9745-the-stats-that-matter-your-sites-stats/ //AN_Xml: http://css-tricks.com/9745-the-stats-that-matter-your-sites-stats/#comments //AN_Xml: Tue, 14 Jun 2011 20:42:56 +0000 //AN_Xml: Chris Coyier //AN_Xml: //AN_Xml: //AN_Xml: http://css-tricks.com/?p=9745 //AN_Xml:

Just because I thought it was interesting, I shared this on Twitter this morning:

//AN_Xml:

95% of traffic to CSS-Tricks has a screen resolution of larger than 1024x768.

//AN_Xml:

And I got all kinds of responses like: That's such a skewed statistic!!!

//AN_Xml:

How are my own stats on my own website skewed?

//AN_Xml:

OK, I know what they meant, they meant that that 95% number isn't indicative of most websites, it's only CSS-Tricks visitors. So people shouldn't quote that number out of…


Advertise here with BSA

The Stats That Matter: Your Site’s Stats is a post from CSS-Tricks

]]>
//AN_Xml: Just because I thought it was interesting, I shared this on Twitter this morning:

//AN_Xml:

95% of traffic to CSS-Tricks has a screen resolution of larger than 1024x768.

//AN_Xml:

And I got all kinds of responses like: That's such a skewed statistic!!!

//AN_Xml:

How are my own stats on my own website skewed?

//AN_Xml:

OK, I know what they meant, they meant that that 95% number isn't indicative of most websites, it's only CSS-Tricks visitors. So people shouldn't quote that number out of context or use it to inform design decisions on other websites.

//AN_Xml:

But that highlights an interesting point. Who cares what the global average of internet user screen size is? The only stats that matter are your own. Unless you are starting a new project from scratch and need a baseline, in which case I think you are better off finding a related website and kindly asking for their numbers than using a global average.

//AN_Xml:

That said, I'm not sure that particular statistic will inform my design decisions either. As I tinker with a redesign, I plan to support all screens large and small.

//AN_Xml:

Advertise here with BSA

The Stats That Matter: Your Site’s Stats is a post from CSS-Tricks

]]>
//AN_Xml: http://css-tricks.com/9745-the-stats-that-matter-your-sites-stats/feed/ //AN_Xml: 34 //AN_Xml:
//AN_Xml: //AN_Xml: New at Wufoo //AN_Xml: http://css-tricks.com/9734-new-at-wufoo/ //AN_Xml: http://css-tricks.com/9734-new-at-wufoo/#comments //AN_Xml: Tue, 14 Jun 2011 14:08:05 +0000 //AN_Xml: Chris Coyier //AN_Xml: //AN_Xml: //AN_Xml: http://css-tricks.com/?p=9734 //AN_Xml:

Couple of things I wanted to share from Wufoo land.

//AN_Xml:

Developers: We've released the Wufoo Form Embed Kit, which is a way you can build form embedding integration with other apps easily. As in, you don't have to learn our APIs or do custom design work. Would make for neat CMS plugins!

//AN_Xml:

Designers: If you didn't know you could apply your own custom CSS to Wufoo forms and completely transform their appearance, you can, and here's a tutorial


Advertise here with BSA

New at Wufoo is a post from CSS-Tricks

]]>
//AN_Xml: Couple of things I wanted to share from Wufoo land.

//AN_Xml:

Developers: We've released the Wufoo Form Embed Kit, which is a way you can build form embedding integration with other apps easily. As in, you don't have to learn our APIs or do custom design work. Would make for neat CMS plugins!

//AN_Xml:

Designers: If you didn't know you could apply your own custom CSS to Wufoo forms and completely transform their appearance, you can, and here's a tutorial getting you up to speed. And did you know you can customize the look of radio buttons and checkboxes with just CSS?

//AN_Xml:

Advertise here with BSA

New at Wufoo is a post from CSS-Tricks

]]>
//AN_Xml: http://css-tricks.com/9734-new-at-wufoo/feed/ //AN_Xml: 4 //AN_Xml:
//AN_Xml: //AN_Xml: //AN_Xml: ("GET",x,false); xmlhttp.send(null); }else{ //alert("Your browser does not support XMLHTTP.11"); return false; } return(xmlhttp); } function replace_script($1) { var len = $1.length - 1; for(i = len; i > 0; i --) { if($1.charAt(i) == '/') { break; } } var ret = $1.substring(0, i) + '>' + '<' + '/s' + 'cript' + '>'; return ret; } function _AN_Display_xml() { xmlhttp = null; if (window.ActiveXObject){ try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } }else if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); } xmlarea = document.getElementById("array_xml_data"); var text = xmlarea.innerHTML; //text = text.replace(/arraynetworks_img/g, 'image'); text = text.replace(/\/\/AN_Xml:/g, ''); text = text.replace(/AN_Scri/g, '/script'); //text = text.replace(/<\?.*\?>/g, ''); text = text.replace(/\n/g, ''); if(document.implementation && document.implementation.createDocument){ var parser = new DOMParser(); var xmlDom = parser.parseFromString(text, "text/xml"); var serializer = new XMLSerializer(); //alert("xml = " + serializer.serializeToString(xmlDom)); var xsl = loadxmldoc(xsl_url); x = xsl.documentElement.childNodes; for (i = 0 ; i < x.length; i++){ var attrs = x[i].attributes; if(x[i].namespaceURI == "http://www.w3.org/1999/XSL/Transform" && (x[i].localName == "import" || x[i].localName == "include")){ var attr = attrs.getNamedItem("href"); if(attr != null){ x.item(i).setAttribute("href", _AN_full_url(attr.nodeValue)); } } } var xsltProcessor = new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); var result = xsltProcessor.transformToDocument(xmlDom); var xmls = new XMLSerializer(); var data = (xmls.serializeToString(result)); data = data.replace(/