加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 业界 > 正文

给计划师的jQuery教程(第三部门)

发布时间:2018-08-18 10:16:55 所属栏目:业界 来源:站长网
导读:文章导读: 给计划师的jQuery教程(第一部门) 给计划师的jQuery教程(第二部门) 7.可折叠面板(Demo) 团结前面的能力我们来实现一个可折叠的面板列(相同于gmail的邮件面板)。是否留意到我在Web Designer Wall的留言列表也运用了这种个结果? Copy to
副问题[/!--empirenews.page--]

文章导读:

给计划师的jQuery教程(第一部门)
给计划师的jQuery教程(第二部门)

7.可折叠面板(Demo)

团结前面的能力我们来实现一个可折叠的面板列(相同于gmail的邮件面板)。是否留意到我在Web Designer Wall的留言列表也运用了这种个结果?

给计划师的jQuery教程(第三部门)

Copy to ClipboardLiehuo.Net Codes引用的内容:[www.veryhuo.com] $(document).ready(function(){

//hide message_body after the first one
$(".message_list .message_body:gt(0)").hide();

//hide message li after the 5th
$(".message_list li:gt(4)").hide();

//toggle message_body
$(".message_head").click(function(){
$(this).next(".message_body").slideToggle(500)
return false;
});

//collapse all messages
$(".collpase_all_message").click(function(){
$(".message_body").slideUp(500)
return false;
});

//show all messages
$(".show_all_message").click(function(){
$(this).hide()
$(".show_recent_only").show()
$(".message_list li:gt(4)").slideDown()
return false;
});

//show recent messages only
$(".show_recent_only").click(function(){
$(this).hide()
$(".show_all_message").show()
$(".message_list li:gt(4)").slideUp()
return false;
});

});

每部门代码的细节:

影藏撤除第一个的全部<div class=”message_body”>
影藏第四个<li>后头的全部<li>
当<p calss=”message_head”>被点击后,滑入表现兄弟元素<div class=”message_body”>
绑定<a class=”collpase_all_message”>按钮click变乱,滑出影藏全部的<div class=”message_body”>
绑定<a class=”show_all_message”>按钮click变乱,影藏了本身,表现<a class=”show_recent_only”>,滑入表现全部的剩下的全部的<li>
绑定<a class=”show_recent_only”>按钮click变乱,影藏本身,表现<a class=”show_all_message”>,而且影藏撤除前5个<li>

8.仿照WordPress的留言打点靠山(Demo)

我信托你们大大都人都看到过WordPress留言打点的靠山。让我们用jQuery来仿照着试试看。为了仿照它的配景颜色,你必需添加Color Anination插件。

给计划师的jQuery教程(第三部门)

Copy to ClipboardLiehuo.Net Codes引用的内容:[www.veryhuo.com] //don't forget to include the Color Animations plugin
//<script type="text/javascript" src="jquery.color.js"></script>

$(document).ready(function(){

$(".pane:even").addClass("alt");

$(".pane .btn-delete").click(function(){
alert("This comment will be deleted!");

$(this).parents(".pane").animate({ backgroundColor: "#fbc7c7" }, "fast")
.animate({ opacity: "hide" }, "slow")
return false;
});

$(".pane .btn-unapprove").click(function(){
$(this).parents(".pane").animate({ backgroundColor: "#fff568" }, "fast")
.animate({ backgroundColor: "#ffffff" }, "slow")
.addClass("spam")
return false;
});

$(".pane .btn-approve").click(function(){
$(this).parents(".pane").animate({ backgroundColor: "#dafda5" }, "fast")
.animate({ backgroundColor: "#ffffff" }, "slow")
.removeClass("spam")
return false;
});

$(".pane .btn-spam").click(function(){
$(this).parents(".pane").animate({ backgroundColor: "#fbc7c7" }, "fast")
.animate({ opacity: "hide" }, "slow")
return false;
});

});

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读