要有兩張圖片
STEP1 HTML
<a href="#"><div id="fbicon"><img src="img/fb.png" width="25" height="24" /></div></a>
STEP2 CSS
#fbicon {
float:right;
width:25px;
height:24px;
background-image: url(../../../img/fb_over.png);
}
STEP3 JQUERY
//圖片置換 滑鼠移入
function picover(hit_area){
$(hit_area).hover(function() {
$(hit_area+' img').hide();
},
function(){
$(hit_area+' img').show();
})
}
picover('#fbicon ');//這裡就只要用到的地方就加一行
2011年8月4日 星期四
2011年8月3日 星期三
li子層 寬度 比父層 寬 時不要設定overflow: hidden;
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<style>
* {
margin:0px;
padding:0px;
list-style-position:none;
list-style-type:none;
float:none;
}
#content {
width:500px;
}
#content ul{
width:500px;
}
.level1{
width:80px;
float:left;
list-style-type: none;
}
.bg{
width:50px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.level1 {
background-color: #FC0;
}
.level2 li {
width:150px;
background-color: #000;
color:#fff;
}
</style>
</head>
<body>
<div id="content">
<ul class="menu">
<li class="level1"><div class="bg"><a href="">work</a></div>
<ul class="level2">
<li>aaa</li>
<li>bbb</li>
<li>ccc</li>
</ul>
</li>
<li class="level1"><div class="bg"><a href="">news</a></div>
<ul class="level2">
<li>aaa</li>
<li>bbb</li>
<li>ccc</li>
</ul>
</li>
</ul>
</div>
</body>
<script language="javascript">
$(document).ready(function(){
$('.level1').hover(function() {
//$('#work ul').slideDown('slow');
$(this).children('.level2').show();
},
function(){
//$('#work ul').slideUp('slow');
$(this).children('.level2').hide();
}
)
/*
); */
})
</script>
</html>
///overflow: hidden; 取消這個即可
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
<style>
* {
margin:0px;
padding:0px;
list-style-position:none;
list-style-type:none;
float:none;
}
#content {
width:500px;
}
#content ul{
width:500px;
}
.level1{
width:80px;
float:left;
list-style-type: none;
}
.bg{
width:50px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.level1 {
background-color: #FC0;
}
.level2 li {
width:150px;
background-color: #000;
color:#fff;
}
</style>
</head>
<body>
<div id="content">
<ul class="menu">
<li class="level1"><div class="bg"><a href="">work</a></div>
<ul class="level2">
<li>aaa</li>
<li>bbb</li>
<li>ccc</li>
</ul>
</li>
<li class="level1"><div class="bg"><a href="">news</a></div>
<ul class="level2">
<li>aaa</li>
<li>bbb</li>
<li>ccc</li>
</ul>
</li>
</ul>
</div>
</body>
<script language="javascript">
$(document).ready(function(){
$('.level1').hover(function() {
//$('#work ul').slideDown('slow');
$(this).children('.level2').show();
},
function(){
//$('#work ul').slideUp('slow');
$(this).children('.level2').hide();
}
)
/*
); */
})
</script>
</html>
///overflow: hidden; 取消這個即可
2011年8月2日 星期二
2011年8月1日 星期一
最基本的路徑概念
以資料夾名稱開頭 表示以該檔案為中心出發,底下即是跟該檔案同一層的img資料夾
img/
以 / 開頭表示以伺服器下 找目錄wordpress 底下的img資料夾
/wordpress/img
img/
以 / 開頭表示以伺服器下 找目錄wordpress 底下的img資料夾
/wordpress/img
訂閱:
文章 (Atom)