简体   繁体   English

此选择器具有多个元素错误

[英]This selector has more than 1 element Error

I keep getting the error TurnJsError: This selector has more than 1 element i have made a few checks in Firebug and i know that my Jquery is being loaded as are all my libraries/scripts i need. 我一直收到错误TurnJsError:这个选择器有多个元素我在Firebug中做了一些检查,我知道我的Jquery正在加载,因为我需要的所有库/脚本。

The error appears after my page has loaded, if i add the following part of my javascript to the console and run it before the page has fully loaded then its ok but still returns the same error as above, however if i let the page load (get the error from above again) and then run that script in console i get another error TypeError: Argument 1 of Node.insertBefore does not implement interface Node. 我的页面加载后出现错误,如果我将我的javascript的以下部分添加到控制台并在页面完全加载之前运行它然后确定但仍然返回与上面相同的错误,但是如果我让页面加载(再次从上面得到错误)然后在控制台中运行该脚本我得到另一个错误TypeError:Node.insertBefore的参数1没有实现接口Node。 :

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
});
});

Could i be missing something thats the cause for throwing these errors? 我可能会遗漏导致这些错误的原因吗?

when i add .first() so its like $('.flipbook').first().turn({ after the page has fully loaded i get slight movement in my image, but still getting the error TypeError: Argument 1 of Node.insertBefore does not implement interface Node. When i click on my image it dissapears but the next image is not displayed instead i get another error TypeError: c is null 当我添加.first()所以它就像$('。flipbook')。first()。turn({页面完全加载后我在我的图像中轻微移动,但仍然得到错误TypeError:Node的参数1 .insertBefore没有实现接口节点。当我点击我的图像时它消失但下一个图像没有显示而是我得到另一个错误TypeError:c为null

turn.js work with a single element. turn.js使用单个元素。 Use the .each function. 使用.each函数。

$('.flipbook').each(function(){
    $(this).turn(...);
})

Note that turn may need a unique id on the container. 请注意,转弯可能需要容器上的唯一ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM