我需要有关我的 jQuery 脚本的帮助,img
鼠标悬停和.conceptcontent
显示类时的更改,鼠标离开时的img
更改,但我可以隐藏.conceptcontent
类吗?
(function ($) {
$(".img-swap").hover(
function () {
this.src = this.src.replace("_off", "_on");
$(".conceptcontent").show("slow");
},
function () {
this.src = this.src.replace("_on", "_off");
});
var imgSwap = []; $(".img-swap").each(function () {
imgUrl = this.src.replace("_off", "_on");
imgSwap.push(imgUrl);
});
$(imgSwap).preload();
})(jQuery);
html
<title>Untitled Document</title>
</head>
<body>
<!--background-->
<div id="intro">
<h1 id="rubrik">Josef Carlsson</h1>
</div>
<div class="meny">
<div id="home"><img src="iconer/home_off.svg" class="img-swap"></div>
<div id="about"><img src="iconer/ommig_off.svg" class="img-swap"></div>
<div id="design"><img src="iconer/design_off.svg" class="img-swap"></div>
<div id="internet"><img src="iconer/internet_off.svg" class="img-swap"></div>
<div id="camera"><img src="iconer/kamera_off.svg" class="img-swap"></div>
<div id="concept"><img src="iconer/koncept_off.svg" class="img-swap"></div>
</div>
<div class="menytext">
<div id="hometext">Start</div>
<div id="abouttext">About me</div>
<div id="designtext">Design</div>
<div id="internettext">Webb</div>
<div id="cameratext">Pictures</div>
<div id="concepttext">Concepts</div>
</div>
<ul class="conceptcontent">
<li>emotion</li>
<li>[in]sight</li>
<li>will i make it</li>
<li>trace</li>
<li>datemate</li>
<li>pacman</li>
</ul>
这是使用的 html