欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery 模擬雅虎首頁(yè)的點(diǎn)擊對(duì)話框效果

 更新時(shí)間:2010年04月11日 18:41:55   作者:  
jquery模擬雅虎首頁(yè)的點(diǎn)擊對(duì)話框效果實(shí)現(xiàn)代碼,喜歡的朋友可以參考下。
這里說(shuō)明下,這樣的效果腳本之家發(fā)過(guò)類似的效果。具體的可以到腳本下載中心查找。

效果圖:

 

聲明:我做的只是實(shí)現(xiàn)這個(gè)效果,在美觀上并沒有做到y(tǒng)ahoo主頁(yè)這么好看,所以不要介意!

原材料:

 

   

   

思路:

1:為每一個(gè)li標(biāo)簽添加懸浮事件

2:構(gòu)建iframe并獲取到當(dāng)前l(fā)i標(biāo)簽下的a元素的href屬性值

3:構(gòu)建DIV包含iframe元素并顯示
HTML結(jié)構(gòu):

復(fù)制代碼 代碼如下:

<ul>
<Li><a >新聞</a></Li>
<li><a >體育</a></li>
<li><a >娛樂</a></li>
</ul>

CSS樣式:
復(fù)制代碼 代碼如下:

ul{
float:left;
}
ul li{
display:block;
margin-top:15px;
width:100px;
position:relative;
}
a{
text-decoration:none;
color:#8000ff;
}
.show{
width:640px;
height:506px;
position:absolute;
top:-45px;
left:30px;
background:url(1.gif) no-repeat;
padding:45px 20px 35px 40px;
}
.close{
width:22px;
height:22px;
float:right;
display:block;
margin-top:-30px;
background:url(2.gif) no-repeat;
}
.quick{
position:absolute;
top:0px;
left:30px;
background:url(3.jpg) no-repeat;
width:37px;
height:26px;
font-size:12px;
color:white;
line-height:26px;
text-align:center;
}

JS代碼:
復(fù)制代碼 代碼如下:

$(document).ready(function(){
$('ul li a').hover(function(e){
var quickw=$(this).parent().parent().find('#clickdiv');
if(quickw){
$('#clickdiv').remove();
}
$(this).parent().append('<div id="clickdiv">預(yù)覽</div>');
$('#clickdiv').addClass('quick');
$("#clickdiv").click(function(){
$(this).css('display','none');
var url=$(this).parent().find('a').attr('href');
var $basediv=$(this).parent().parent().find('#window');
if($basediv){
$('#window').remove();
$(this).parent()
.append("<div id='window'><div id='closebutton'><a href='#'></a></div><iframe frameborder='0' hspace='0' src='"+url+"' style='width:640px;height:506px;'></iframe></div>")
.fadeIn('slow');
$("ul li #window").addClass('show');
$('#closebutton a').addClass('close');
$('#closebutton a').click(function(){
$("ul li #window").remove();
});
}
});

相關(guān)文章

最新評(píng)論