即时尝试为图像创建边框时,我将鼠标悬停但它不添加它:S但我已尝试console.log,它显示文字我已写入,但它dosent添加类到它:小号jquery addclass问题
这是我的代码
<style>
.test {
border: 1px solid #000;
}
</style>
// add a class to the image that is focus on
$('#small-image .thumb').hover(function() {
$(this).addClass('test');
console.log('hover');
}, function() {
$(this).removeClass('test');
console.log('out');
});
你为什么要使用jQuery和CSS不? '.thumb:hover {border:1px solid#000}'? – Phil 2011-04-12 21:32:10
你有一个jsfiddler.net的例子,你在做什么? – LeRoy 2011-04-12 21:33:39