我正在尝试构建一个媒体播放列表,可以在结束信用、播放视频和缩略图悬停时更改标题,并在下一个/上一个点击时。因此,我需要编写一些函数,然后可以一起调用。就像这样:
function showBox()
{
$(this).parents('.container').find('.box').show();
};
function hideBox()
{
$(this).parents('.container').find('.box').hide();
};
$('a').hover(
function()
{
showBox();
},
function()
{
hideBox();
}
);
问题在于$(this)不能从.hover函数传递到其他函数中。我该怎么做?
.theBox('open') / .theBox('close')
更符合规范。 - Orblingswitch(cmd){...}
来处理各种不同的命令,而不是上面展示的可爱的小技巧。 - Phrogz