gpt4 book ai didi

jquery - 无法在层次结构中的指定点插入节点”代码 : "3

转载 作者:行者123 更新时间:2023-12-03 22:59:24 26 4
gpt4 key购买 nike

嘿,又是我问了一个关于 jquery 的问题,gridlayout我制作了一个带有 switch 的 php 模板,我插入的代码是这样的

<div id="wrapper">

<div id="grid">
<div class="box"><img src="img/an_005_BUR_thebeat.jpg" width="310px" height="438px" />3 index</div>
<div class="box"><img src="img/an_014_GUE_homme_a.jpg" width="310px" height="404px" />4 Culture</div>
<div class="box"><img src="img/an_044_BVL_springmotiv.jpg" width="310px" height="310px" />5 Pharma</div>
<div class="box"><img src="img/an_039_AN_diskette.jpg" width="310px" height="465px" />6 Pharma IT</div>
<div class="box"><img width="310px" height="100px" />7 Culture</div>
<div class="box"><img width="310px" height="120px" />8 Cosmetics</div>
<div class="box"><img width="310px" height="400px" />9 IT</div>
<div class="box"><img width="310px" height="400px" />10 Culture</div>
<div class="box"><img width="310px" height="400px" />11 IT</div>
<div class="box"><img width="310px" height="400px" />12 Culture</div>
</div>

</div>
<script type="text/javascript">

$(document).ready(function(){

$('#grid').gridLayout('.box', {col_width: 340, min_cols: 2});
// options - (values above are the defaults)
// col_width: the width of each grid block
// min_cols: the minimum number of cols on the page (reducing browser width below this will not decrease number of columns). Set to your largest block (3 = block spans 3 columns)

// gridLayout.placeAtEnd() - for placing a block at bottom right of grid
var final_block = $('');
$('#grid').gridLayout.placeAtEnd( final_block );

// gridchange event fires when window resize forces a grid refresh
$('#grid').bind( "gridchange", function(e){
console.log('gridchange event fired');
// reposition the final block
$('#grid').gridLayout.placeAtEnd( final_block );
});

// this forces a redraw of grid
$('body').gridLayout.refresh();

// returns heights of each column
console.log( 'gridLayout.info():', $('#grid').gridLayout.info() );
});

</script>

jquery 脚本和插件已加载到 header 中。当我尝试运行这个时。 Firebug 告诉我:

“节点无法插入到层次结构中的指定点”代码:“3”

有人知道如何解决这个问题吗?

这是我加载的示例:http://18735.webhosting7.1blu.de/neu/index.php?item=lifestyle

最佳答案

我很确定您的错误在于以下内容。 $('') 是什么!

var final_block = $('');
$('#grid').gridLayout.placeAtEnd( final_block );

只要我说,它就会起作用

var final_block = $('<div />');
$('#grid').gridLayout.placeAtEnd( final_block );

关于jquery - 无法在层次结构中的指定点插入节点”代码 : "3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1119211/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com