本文实例讲述了基于
jquery
创建鼠标悬停效果的方法。分享给大家供大家参考。具体实现方法如下:
1. 创建HTML:
2. 选择.mainnav的class:
3. 建立变量imgPath,指定图片SRC:
基于jQuery的AJAX和JSON的实例 中文WORD版
本文档主要讲述的是基于jQuery的AJAX和JSON的实例;过jQuery内置的AJAX功能,直接访问后台获得JSON格式的数据,然后通过jQuer把数据绑定到事先设计好的html模板上,直接在页面上显示。有需要的朋友可以下载看看
下载
4. 找到字符串off,用on替换:
希望本文所述对大家的jQuery程序设计有所帮助。
- @@##@@
$(".mainnav").hover(
function () {
},
function () {
}
);
$(".mainnav").hover(
function () {
// Grab the source
var imgPath = $(this).attr("src");
},
function () {
// Grab the source
var imgPath = $(this).attr("src");
}
);
$(".mainnav").hover(
function () {
// Grab the source
var imgPath = $(this).attr("src");
// Replace the path in the source
$(this).attr("src",imgPath.replace("off", "on"));
},
function () {
// Grab the source
var imgPath = $(this).attr("src");
// Replace the path in the source
$(this).attr("src",imgPath.replace("on", "off"));
}
);