紅茶小館

一杯紅茶喜相逢 Share Web Tech and Life …
Jul 13

用這個 function 就可防止圖片大於screen, 難於觀看。


 $("img").each(function(){
     if($(this).width() > $(this).parent().width()) {
         $(this).width("100%");
     }
 }); 
Jul 2

另一個手工打造的 Jquery 例子.較輕巧方便。

http://15daysofjquery.com/edit-in-place-with-ajax-using-jquery-javascript-library/15/

Jul 2
Jquery edit in place
icon1 vincent | icon2 JavaScript | icon4 07 2nd, 2008| icon31 Comment »

Project 需要做一個 in place edit 的表格,

JQuery 已有plug-in, 相當好用. 不用自己寫 . good~

http://blog.yoren.info/tag/edit-in-place/

Jul 2
ajax sample code
icon1 vincent | icon2 JavaScript | icon4 07 2nd, 2008| icon31 Comment »

每個 Event 都有手工打造的 ajax 例子, 可以下載 source code

研究. 用了mvc model.

http://www.studiosedition.com/?events=

Jun 27
xml and xsl
icon1 vincent | icon2 JavaScript | icon4 06 27th, 2008| icon3No Comments »

由於公司的  SERVER 不支援 SERVER SIDE programming 和沒有 DB .

要做Data searching and filtering 唯有借助 xml,
用 xsl接收不同的參數做不同的模版,
再用 javascript 把 xml transform 成 HTML
詳細看了這個網站的 例子和 source code, 終於成功。
http://msell.customer.netspace.net.au/

Jun 23
Jquery Image Swap
icon1 vincent | icon2 JavaScript | icon4 06 23rd, 2008| icon338 Comments »

幾行就OK~

$(document).ready(function(){
    x = document.getElementById('imgID');
    $('.swapImageClass').bind('click', 'any_data', function(e){
        x.src = $(this).attr("src");
    });
});
Jun 22
中文 bookmarklet
icon1 vincent | icon2 JavaScript | icon4 06 22nd, 2008| icon3No Comments »

我喜歡看中文 文章 字間加spacing 且 字大清楚, 看報紙好得多。

寫了這個更改網站的字體 spacing & line height 的 bookmarklet

把此 Link Drag 到 toolbar.