首页 > 解决方案 > SyntaxError: missing ) 在参数列表后 - JavaScript - jQuery

问题描述

我收到此错误:

Uncaught SyntaxError: missing ) 在参数列表之后

这是我的 JavaScript / jQuery 代码:

jQuery(function($) {
  $(".menu-toggle").hover(function() {
    $("#Wrapper").css("transform", "perspective(900px) rotateY(-5deg)")
  };
  }, function() {
    $("#Wrapper").css("transform", "perspective(0px) rotateY(0deg)")
  };
});
});

非常感谢您的帮助!

标签: javascriptjquery

解决方案


.hover()可以带两个功能。您的语法不正确,因为您使用的是;而不是,.

根据 jQuery文档删除;并替换为 a 。也替换为底部。,}););

我已经格式化以使其更易于阅读。

$(".menu-toggle").hover(
  function() {
    $("#Wrapper").css("transform", "perspective(900px) rotateY(-5deg)");
  }, 
  function() {
    $("#Wrapper").css("transform", "perspective(0px) rotateY(0deg)");
  }
);

推荐阅读