私は単にホバートリガをクリックに変更しようとしていますが、何らかの理由で私が使用しているクリック機能は動作しません。onclick、クリックしないでください。 jquery
あなたが置くと働くこの私の現在のコード...
ホバー上で作業する現在のスクリプトザッツ...
$showSidebar.hover(function() {
$wrapper.stop().animate({ left: "-178px" }, 300);
$sidebarSlider.stop().animate({ width: "452px" }, 300);
$latestTweet.stop().animate({width: "452px", top : "-1px", backgroundColor: "#464848" }, 300);
}, function() {
$wrapper.stop().animate({ left: "0" }, 300);
$sidebarSlider.stop().animate({ width: "274px" }, 300);
$latestTweet.stop().animate({ top : "-1px", width: "274px", backgroundColor: "#464848" }, 300);
});
しかし、クリックされたとき、それは仕事を取得するには、以下の私の試みを参照してください。しかし、奇妙なことに何も起こらない。
私の試みの一つ
$showSidebar.click(function() {
$wrapper.stop().animate({ left: "-178px" }, 300);
$sidebarSlider.stop().animate({ width: "452px" }, 300);
$latestTweet.stop().animate({width: "452px", top : "-1px", backgroundColor: "#464848" }, 300);
}, function() {
$wrapper.stop().animate({ left: "0" }, 300);
$sidebarSlider.stop().animate({ width: "274px" }, 300);
$latestTweet.stop().animate({ top : "-1px", width: "274px", backgroundColor: "#464848" }, 300);
});
と
私の試み二
$showSidebar.on('click', function() {
$wrapper.stop().animate({ left: "-178px" }, 300);
$sidebarSlider.stop().animate({ width: "452px" }, 300);
$latestTweet.stop().animate({width: "452px", top : "-1px", backgroundColor: "#464848" }, 300);
}, function() {
$wrapper.stop().animate({ left: "0" }, 300);
$sidebarSlider.stop().animate({ width: "274px" }, 300);
$latestTweet.stop().animate({ top : "-1px", width: "274px", backgroundColor: "#464848" }, 300);
});
と他人のカップルが、nudda ...
これは私ですマークアップ...
<a href="#" title="More" class="button blu large" id="show-sidebar"><span>//</span> MORE</a>
と私のVAR
$showSidebar = $("#show-sidebar");
私が間違っているつもりです任意のアイデア?大いに助けになるでしょうか?
$showSidebar.on('click', function() {
if ($showSidebar.html() == '<span>//</span> CLOSE') {
$wrapper.stop().animate({ left: "0" }, 300);
$sidebarSlider.stop().animate({ width: "274px" }, 300);
$latestTweet.stop().animate({ top : "-1px", width: "274px", backgroundColor: "#464848" }, 300);
} else {
$wrapper.stop().animate({ left: "-178px" }, 300);
$sidebarSlider.stop().animate({ width: "452px" }, 300);
$latestTweet.stop().animate({width: "452px", top : "-1px", backgroundColor: "#464848" }, 300);
$showSidebar.html('<span>//</span> CLOSE');
}
});
使用 'FFでFirebug'あなたが任意のJavaScriptのエラーを得るのですか? – Cyclonecode
なぜ2つのパラメータを '.click()'に渡しますか? – zerkms
いいえ、構文エラー、何もない: -/ – Joshc