- $(function () {
- $("#pics img").css("cursor", "crosshair").hover(function (e) {
- this.mytitle = (this.alt == "undefined" ? "请刷新网页以加载说明文字……" : this.alt);
- this.alt = "";
- $("body").append("<div id='randonpic'><img width='226' src='" + this.src + "' /><br />" + this.mytitle + "</div>");
- $("#randonpic").css({ "left": e.pageX + 10 + "px", "top": e.pageY + 20 + "px" }).show("fast");
- }, function () {
- this.alt = this.mytitle;
- $("#randonpic").remove();
- }).mousemove(function (e) {
- $("#randonpic").css({ "left": e.pageX + 10 + "px", "top": e.pageY + 20 + "px" });
- });
- });
复制代码 这里的hover就是运用了鼠标移到指定图片上和鼠标移开时的图片切换效果,慢慢研究吧。 |