1.先要将B隐藏,添加idB面内容
2.添加方法A面内容
3.js:function fn(){
var divb = document.getElementById("divb");
var diva = document.getElementById("diva");
diva.style.display="none";
divb.style.display="block";
}
同理可以设置鼠标移除 B隐藏,A显示
$(function(){
$('li div.a').hover(
function(){
$(this).hide();
$(this).next().show();
},
function(){
$(this).show();
$(this).next().hide();
}
)
})
$(function () {
function toggleFn() {
$(this).find('div').toggle();
};
$('li').hover(toggleFn, toggleFn);
});
$('.a').mouseenter(function() {
this.style.display = 'none';
this.nextElementSibling.style.display = 'block';
});
$('.a').mouseout(function() {
this.style.display = 'block';
this.nextElementSibling.style.display = 'none';
});