1816 次
3 に答える
5
.not()
ブール値ではなく、フィルタリングされた jQuery オブジェクトを返します。
あなたは書くべきですif (!$(...).is(':focus'))
于 2012-05-15T13:38:05.720 に答える
1
このコードはそれを行う必要があります。
$('#toolbar').hover(
function() {
var toolbarposition = $(this).position();
if (toolbarposition.top == -115) {
$(this).animate({top: '0'}, 300);
}
},
function() {
var toolbarposition = $(this).position();
if (toolbarposition.top == 0 && !$('#toolbar form select').is(':focus')) {
$(this).animate({top: '-115'}, 300);
}
}
);
于 2012-05-15T13:40:09.837 に答える
0
以下のコードは、あなたが望むことを行います。ただし、要素にフォーカスがあり、ツールバーの外側をクリックすると、マウスオーバー ハンドラーが起動しないという状況を修正する必要があります。
$('#toolbar').hover(
function() {
var toolbarposition = $(this).position();
if (toolbarposition.top == -115) {
$(this).animate({top: '0'}, 300);
}
},
function() {
var toolbarposition = $(this).position();
if (toolbarposition.top == 0 && !$('#toolbar form').has(':focus').length) {
$(this).animate({top: '-115'}, 300);
}
}
);
于 2012-05-15T13:47:17.640 に答える