【问题标题】:TypeError: $(...).turn is not a functionTypeError: $(...).turn 不是函数
【发布时间】:2014-01-24 12:47:04
【问题描述】:

我正在使用 turn.js,但是我收到错误 TypeError: $(...).turn is not a function 目前我的 js 是:

function loadApp() {
   // Create the flipbook
   $('.flipbook').turn({
        // Width
        width:922,

        // Height
        height:600,

        // Elevation
        elevation: 50,

        // Enable gradients
        gradients: true,

        // Auto center this flipbook
        autoCenter: true
   });
}

// Load the HTML4 version if there's not CSS transform
$(document).ready(function() {  
   yepnope({
      test : Modernizr.csstransforms,
      yep: ['../../lib/turn.js'],
      nope: ['../../lib/turn.html4.min.js'],
      both: ['css/basic.css'],
      complete: loadApp
   });
});

有什么我可能会出错的想法吗?

【问题讨论】:

  • 脚本加载是否正确
  • 控制台还有其他错误吗?
  • 你有没有把jquery添加到你的页面

标签: javascript turnjs


【解决方案1】:

很难只给出一个答案,因为这里可能有很多问题。 但是,我认为问题应该是没有正确加载 jQuery 或 turn.js。

所以,我建议,首先,您打开您选择的浏览器的开发者工具并检查 jQuery 和 turn.js 是否确实被加载到页面中。另外 jQuery 必须在 turn.js 之前,以便 turn.js 正常工作。

【讨论】:

  • 谢谢!这是我自己的错,我之前在测试其他东西时注释掉了 turn.js,却忘了再次取消注释!
猜你喜欢
  • 2019-08-27
  • 2020-06-29
  • 2020-06-17
  • 1970-01-01
  • 1970-01-01
  • 2020-03-03
  • 2021-06-05
  • 2019-10-03
  • 2017-03-06
相关资源
最近更新 更多