转到正文

浪淘沙

静观己心,厚积薄发

存档

标签: 选择器

原文地址:http://www.php100.com/html/webkaifa/DIV_CSS/2013/0409/13345.html

高效的CSS已经不是一个新话题,也不是一个我非得重拾的话题,但是,它却是自我在SKY工作以后,真正感兴趣并始终关注的一个话题。

很多人或者忘记了,或者仅仅是没有意识到,CSS可以是高效的也可能导致低能。然而,我们可以不考虑当你自认为会的太少而使用了低效的CSS这种情况。

这些规则只真正用在性能要求很高的网站上,这些网站对速度要求很高,任何一个页面可能含有成百上千个DOM元素。但是实践出真理,不管你是在打造下一个facebook 还是在开发一个本地的展示网页,多学点总是好的…. 继续阅读

原文地址:http://www.websanova.com/tutorials/jquery/12-awesome-jquery-selector-extensions

I recently began writing my own jQuery selectors more and more as I realized it’s a very nice and clean way to accomplish some specific tasks that I may normally have used an iterator for. It’s one of those things that if you’re not looking for you’ll never see, so I decided to write a little tutorial on it as setting up your own selectors is extremely easy with jQuery.

Here is a little boiler plate for creating your own jQuery selectors and pretty much all you’ll need:

$.extend($.expr[':'],
{
 selectorName: function(el, i, m)
 {
 return true/false;
 },

 selectorName2: function(el, i, m)
 {
 return true/false;
 }
});

Below are two ways to call a selector, one with an argument and one without.
继续阅读