《Monster Mashup项目开发:jQuery交互与动画效果实现》
1. 用户界面交互设置
在Monster Mashup项目中,用户界面的交互设计是关键部分。每点击9次,每个图像条带应“倒带”回到开头。界面包含头部区域、眼睛区域、鼻子区域、嘴巴区域、框架和容器,还有闪电相关的图像元素。要让界面可点击,需要跟踪每次点击,以便能倒带图像条带。每个区域都需通过点击来推进图像。
以下是让 div#head 元素可点击的代码示例:
$(document).ready(function(){
$("#head").click(function(){
if (headclix < 9){
headclix += 1;
}
else {
headclix = 0;
}
});
});
var headclix = 0;
接着,为了让眼睛、鼻子和嘴巴元素也可点击,可按如下方式编写代码:
$(document).ready(function(){
var headclix = 0, eyeclix=0, noseclix= 0, mouthclix = 0;
$("#head").click(function(){
if (headclix < 9){
headclix +=
超级会员免费看
订阅专栏 解锁全文
9

被折叠的 条评论
为什么被折叠?



