this vs $(this) in jQuery

I don’t know why, but this is how it happens. When I make a jQuery plugin, the skeleton is And if I need an each operation inside plugin, the skeleton can be The interesting thing is inside each, I must use “$(this)” to run jQuery functions, but outside each, I can also use “this”. I… Continue reading this vs $(this) in jQuery

CSS styling without images

I am quite surprised with the styling effect achieved by pure CSS without the help of images. I can round corner and rotate html elements without creating any background images. See the result I get. And this is the ONLY product image in this CSS styling demo: Although the effect is comprehensive, but with the… Continue reading CSS styling without images

Stupid IE6

我负责的一个网站的访问者中, IE6 用户仍占 6.2%,这个比例不尴不尬。改版初期对他们照顾不够,今天下狠心花了时间去测试 IE6 下的兼容性。几小时之后,IE6 下都能完全正常显示了,我也多了一些心得。 如果要加层,先设置该层 text-align:left,否则 IE6 下与层有点关系的元素,不管它是在层内还是层外,位置会摆置得莫名其妙。特别是当看到层外元素整体摆错位置,我更莫名其妙,实在搞不懂 IE6 对层的理解是什么。如果一开始就对层进行初始化({ text-align:left; position:relative; })就会节省很多时间。 避免使用高级的 css 语法,比如多 class 的连贯,.class-a.class-b { color:red; }。本希望该样式只应用于同时具有 class-a 和 class-b 元素,结果 IE6 不理解。如果 IE6 对不理解的 selector 作忽略处理倒还好,可是 IE6 把该样式应用到了所有 class-b 元素(只具有 class-a、不具有 class-b 的元素未受影响),IE6 是不是显得不懂装懂?祸害很大,害我多花了一小时在找被错误影响了的 class-b 元素的原因。如果实在想要多 class 的连贯的 selector,那比较可行的办法是用 jquery 来保证跨浏览器的兼容性,即 $jquery(‘.class-a.class-b’) 。 题外话:很久前我写过一篇Cross-browser CSS。今天多了两点心得,本想直接写入以前的文章。转念一想不对,今天的心得是今天的,以前的心得是以前的,以后万一我来翻看自己的文章,我也想从中看出我的成长历程,混在一起就看不出历程了。但从心得角度讲,最好把所有 cross-browser css… Continue reading Stupid IE6

Lightbox not working in Magento 1.4 solved

My case is special – 很久以前为 Magento 1.3 加装 Lightbox 2 时,我听从某人的建议,去掉了 Magento 自带的 scriptaculous effects.js,安装了当时最新的 scriptaculous 1.8.3 effects.js。Lightbox 调试成功后一直没去动它。 Magento 升级到 1.4 后,默认启用 Merge JavaScript Files,这时 Lightbox 就不工作了。如果禁用 Merge JavaScript Files,Lightbox 恢复正常。我调试不出 Lightbox 失效的原因,大概是 js library 版本不兼容。再看了一下 Magento 如今自带 scriptaculous 1.8.2,估计和 1.8.3 相差不大,为了兼容性,干脆就用 Magento 原装的 js。 于是去掉我自装的 scriptaculous 1.8.3 effects.js,启用 Merge JavaScript Files,如我所愿 Lightbox… Continue reading Lightbox not working in Magento 1.4 solved

Style Magento checkout form fields without touching the core code

Although I can change css complete restyle the checkout forms, this is not what I want to discuss today. What I want to achieve are: fix City required asterisk not showing bug change Address lines from full width to half width as City The City required asterisk is hidden by a javascript wrongly. I found… Continue reading Style Magento checkout form fields without touching the core code

Email encoder for not being spidered

我用Email encoder很久了。以前总是去别人网站上运算一下,拿来就用。如今觉得加密算法很多,我应该筛选一下,并作一个适合我自己的常用的工具。 因为跟javascript 字符串加解密有关,我首先找到一段程序,试运行了一下,相当不错,据说还支持中文字符串加密以及中文密码。 function Encrypt(str, pwd) { if(str==””)return “”; str = escape(str); if(!pwd || pwd==””){ var pwd=”1234″; } pwd = escape(pwd); if(pwd == null || pwd.length <= 0) { alert(“Please enter a password with which to encrypt the message.”); return null; } var prand = “”; for(var i=0; i<pwd.length; i++) { prand += pwd.charCodeAt(i).toString();… Continue reading Email encoder for not being spidered