function main()
{
console.log("document ready, Javascript running");
$(".openmenu_container").mouseover(function(){
console.log("mouseover triggered");
$(".sidebar").css("left","0px");
$(".openmenu_container").css("left","-200px");); //Uncaught SyntaxError: Unexpected token)
$(".sidebar").mouseleave(function(){
console.log("mouseleave triggered");
$(".sidebar").css("left","-200px");
$(".openmenu_container").css("left","40px");});
}}
$(document).ready(main);
我已經在我的網站上使用.click()函數的功能邊欄。我想這樣做,以便通過「打開菜單」按鈕進行鼠標移動就足以打開菜單,並且一旦菜單打開,如果用戶將鼠標移出菜單div,菜單將自動關閉。Jquery .mouseover錯誤,不會觸發
錯誤消息是唯一記錄到控制檯的事件,這意味着我的代碼甚至不會運行。錯誤chrome給了我,「Uncaught SyntaxError:Unexpected token」)沒有任何意義,因爲需要第二個')'來完成.mouseover()。我究竟做錯了什麼?我需要第二個參數作爲.mouseover嗎?
的jsfiddle:http://jsfiddle.net/dsghfnrd/2/
哪裏右括號? – 2015-04-03 05:51:27