软件下载 | 资讯教程 | 最近更新 | 下载排行 | 一键转帖 | 发布投稿
您的位置:最火下载站 > Web前端 > jQuery > yui3与jquery的代码对照

yui3与jquery的代码对照

YUI3:

<script>
YUI().use('node', function(Y){
var links = Y.all('div#latest-list .bd li a');
links.on('mouseover', function(ev){
var desc = this.get('parentNode').query('.news-desc');
var popup = Y.get('.popup-desc');
if(!popup){
Y.get(document.body).appendChild(popup = Y.Node.create('<div><\/div>'));
}
popup.set('innerHTML', desc.get('innerHTML')).setStyles({
display: "block",
opacity: 0.9,
top: (ev.clientY + 10) + "px",
left: (ev.clientX + 10) + "px"
});
});
links.on('mouseout', function(ev){
Y.get('.popup-desc').setStyle("display", "none");
});
});
</script>
jquery:

<script>
$(document).ready(function(){
$("div#latest-list .bd li a")
.mouseover(function(ev){
var desc = $("div.news-desc", this.parentNode);
var popup = $("div.popup-desc");
if(popup.length === 0){
popup = $('<div><\/div>').appendTo(document.body);
}
popup.html(desc.html())
.show()
.css("opacity", 0.9)
.css("top", (ev.clientY + 10) + "px")
.css("left", (ev.clientX + 10) + "px");
})
.mouseout(function(ev){
$("div.popup-desc").hide();
});
});
</script>
    相关阅读
    栏目导航
    推荐软件