私が基本的に達成しようとしているのはこれです:画像の上.header-logo
にカーソルを合わせると、この画像がフェードアウトし、#header-search
テキスト入力フィールドがフェードインします。アイデアは、この#header-search
フィールドがアクティブな間、つまり入力している間は表示されたままになるか、ドキュメント内の他の場所をクリックするとフェードアウトするというものです。
ここに jsfiddle のデモがあります: http://jsfiddle.net/neal_fletcher/2SNf6/
HTML:
<img class="header-logo" src="http://placekitten.com/160/50" />
<input id="header-search" type="text" />
jQuery:
$(document).ready(function() {
$('.header-logo').mouseenter(function() {
$('.header-logo').stop(true, true).fadeOut();
$('#header-search').stop(true, true).fadeIn();
});
$('.#header-search').mouseleave(function() {
$('#header-search').stop(true, true).fadeOut();
$('.header-logo').stop(true, true).fadeIn();
});
});
これはまったく可能ですか?それがどのように達成されるかはわかりません。どんな提案でも大歓迎です!