生活在远方

是的,因为真正的生活是在远方

Archive for December 28th, 2008

【jQuery】示例6:可以伸展的面板

是的,这个是示例6,而不是计划中的示例5(投票系统)。因为在jQuery中,进行可以伸展的面板的处理非常简单,只要一个toggle()函数就可以。 核心代码如下: var i=0; $(document).ready( function() { $("div").filter("#clickme").click( function() { i++; $("div").filter("#content").toggle(); if(i%2==0) { $(this).text("Click here to expand."); } else { $(this).text("Click here to collapse."); } } ); } ); 我用了一个变量i来判断要操作的div是处在显示还是隐藏状态,并相应的修改提示文字。通过查看jQuery的源代码,可以知道这也是jQuery中toggle使用的方法。 示例见此处。

Read the rest of this entry »

【广告】猛禽的编程艺术

今天照例上Google Reader看点东西。然后在界面右端的热门推荐中看见了“猛禽的编程艺术”的链接: 不关3721,截个屏保存下来再说…… 顺大便给个链接:http://blog.csdn.net/Raptor/。我在CSDN的blog从不更新……看看,这就是差距啊……

Read the rest of this entry »