标签:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="手风琴.aspx.cs" Inherits="MvcApplication1.Views.手风琴" %>
<%--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">--%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<style type="text/css">
.wrapper ul *
{
transition: all linear 0.1;
}
</style>
<script type="text/javascript">
function bind(el, eventType, callback) {
//捕获和冒泡阶段
if (typeof el.addEventListener === "function") {
el.addEventListener(el, eventType, callback, false);
} else if (typeof el.attechEvent === "function") {
el.attechEvent(‘on‘ + eventType, callback);
}
}
function mouseoverHandler(e) {
var target = e.target || e.scrElement; //事件触发者
var outer = document.getElementById("subject");
var list = outer.getElementsByTagName("li");
for (var i = 0; i < list.length; i++) {
list[i].className = "";
//list[i].className = list[i].className.replace(‘big‘, ‘‘);
}
//事件冒泡,当鼠标悬停在 li里面的元素 触发onmouseover li也会捕获到mouseover
while (target.tagName.toLowerCase != ‘LI‘ || target.tagName==‘body‘) {
target = target.parentNode;
}
target.className = ‘big‘;
}
function init() {
var outer = document.getElementById("subject");
var list = outer.getElementsByTagName("li");
for (var i = 0; i < lelist.length; i++) {
bind(list[i], "mouseover", mouseoverHandler);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="wrapper">
<ul>
<li><a href="#name1">
<img src="../1.jpg" />
<div>
<h3>
</h3>
<p>
</p>
<p>
</p>
</div>
<i></i><i></i></a></li>
</ul>
</div>
</form>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/TT-Cartier/p/4693538.html