嘿嘿,
我想在 jquery 中鼠标悬停时创建一些悬停背景链接!!!
当鼠标悬停在“.nav Menu nav a”上时,我添加 addclass“.hover”,当鼠标移出 removeClass“.hover”
有关我的小提琴的更多信息->演示 JS FIDDLE
HTML : > >
<a href="inc/about/" class="Load frame" id="html" data-html="about"> <div class="hover"></div> about </a> <a href="inc/porject/" class="Load frame" id="html" data-html="project"> <div class="hover"></div> project </a> <a href="inc/story/" class="Load frame" id="html" data-html="story"> <div class="hover"></div> story </a> <a href="inc/contact/" class="Load frame" id="html" data-html="contact"> <div class="hover"></div> contact </a>
CSS:
.navMenu nav { width: 100%; height: auto; list-style-type: none; margin: auto auto; text-align: center; } .navMenu a { height: 4em; width: 100%; text-decoration: none; text-transform: uppercase; text-align: center; display: block; line-height: 4em; font-weight: normal; font-size: 1em; color: rgba(238,79,87,1); position: relative; z-index: 100; } .hover{ /* add background, width, height, ect... */ }
JS:
函数悬停李(){
$(".navMenu a").hover(function(){ $(this).stop(true, true).addClass("hover"); },function(){ $(this).removeClass("hover"); }); }
多谢