鼠标移上去时显示对应的图片信息,不过它是采用了jquery的扩展函数作的一个插件,使用起来就比以前的那个方便多了。html
jquery代码:jquery
$.fn.extend({ AdAdvance:function(){ var listobj=this; var objs =$('dt',this); var view =objs.length-1;//parseInt( Math.random()*objs.length); objs.each(function(i){ $(this).mouseover(function(){ $('dd',listobj).hide();$('.dropList-hover',listobj).attr("class",""); $(this).children("p").attr("class","dropList-hover");$(this).next().show()}) if(i!=view) { $(this).next().hide(); } else { $(this).next().show(); $(this).children("p").attr("class","dropList-hover"); } }); } });
调用方法:dom
$('#news').AdAdvance();
它使用的是dl标签固然你也能够根据本身的须要改为ul的列表标签,dt是标签,dd为图片内容。ide