一部の画像の幅を変更する機能があります。これは、別の関数の別の div にカーソルを合わせると発生します。何らかの理由で、呼び出された関数は数行のコードしか実行せず、その後停止します。
function hey()
{
alert(0);
var $imgContent = ('.imgContent');
$imgContent.css("width","10%");
alert(2);
}
var $content = $('.content');
$content.mouseenter(function() {
$content.removeClass('full').addClass('partial');
$(this).addClass('full').removeClass('partial');
$(this).find('.img1').css('display','none');
$(this).find('.img2').css('display','');
if($(this).hasClass('cont1')){
alert(1);
hey();
}
if($(this).hasClass('cont2')){
}
if($(this).hasClass('cont3')){
}
if($(this).hasClass('cont4')){
}
}).mouseleave(function(){
$(this).find('.img1').css('display','');
$(this).find('.img2').css('display','none');
$(this).removeClass('full').addClass('partial');
});
mouseenter() 関数$(this).hasClass('cont1')
で、アラートを実行するかどうかを確認すると、機能します。その後、関数 hey() を呼び出します。ここで私の問題が発生します。関数 hey() を呼び出した後、別の alert(0) を実行しますが、これも機能します。しかし、その後のコード行は実行されず、最後の alert(2) も機能しません。