[英]Javascript/JQuery to do rollover-effect confirm
So basically I'm doing some distance courses on Javascript with help of JQuery. 因此,基本上,我正在JQuery的帮助下进行一些Java远程课程。 On one of the assignments it demands that:
在一项任务中,它要求:
Because it's originatelly on swedish (I'm born in sweden and speak swedish) I get a bit confused cause every help of information I get on the internet on my programming is in english. 因为它起源于瑞典语(我出生于瑞典语,会说瑞典语),所以我有些困惑,因为我在编程时从互联网上获得的所有信息帮助都是英语。 Hope you understand..
希望你能理解..
$(document).ready(function (){
//bildbyte(attr) med rollover-effekt
$('#lamp').mouseover(function() {
$(this).attr('src', 'pic_bulbon.gif');
});
$('#lamp').mouseout(function() {
$(this).attr('src', 'pic_bulboff.gif');
});
});
Would it seem acceptable? 看起来可以接受吗? Would you confirm it?
你能确认吗? I'm just a bit confused on the rollover effect.
我对过渡效果有些困惑。 The code will represent a lamp that isn't light up.
该代码将代表不点亮的灯。 But as soon you move your mouse over it goes on.
但是,一旦您将鼠标移到它上面,它就会继续。
Opinions? 意见?
I might try using jQuery's hover()
function . 我可能会尝试使用jQuery的
hover()
函数 。 This would help make your code easier to read, and it might help you organize what happens when the bulb turns on/off. 这将有助于使您的代码更易于阅读,并且可能有助于您组织打开/关闭灯泡时发生的情况。 For example:
例如:
var bulbOn = function() { ... }
var bulbOff = function() { ... }
$('#lamp').hover(bulbOn, bulbOff);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.