现在随便那个 JavaScript 框架实现像翻转器这样的功能都再容易不过,它们的基础都是 JavaScript,但框架只会让你变得 stupid。知其然,而不知道其所以然。要是用 jQuery 实现一个两状态翻转,几行就行了。

function() {
    $('img').each(function() {
        $(this).mouseout(function() {
            $(this).attr('src', 'images/' + $(this).attr('id') + '_off.gif');
        });
        $(this).mouseover(function() {
            $(this).attr('src', 'images/' + $(this).attr('id') + '_on.gif');
        });
    });
});

相关文章:

  • 2021-08-29
  • 2021-07-03
  • 2022-01-01
  • 2021-09-11
  • 2021-10-22
  • 2021-07-18
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2021-08-31
  • 2021-09-26
  • 2021-07-05
  • 2021-08-19
  • 2021-12-15
  • 2021-08-31
  • 2021-05-25
相关资源
相似解决方案