계층 구조“코드 :”3의 지정된 지점에서 노드를 삽입 할 수 없습니다.
-
12-09-2019 - |
문제
이봐, 그것은 jQuery에 대한 질문이있는 나야. 그리드 레이아웃 스위치가있는 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 스크립트와 플러그인은 헤더에로드됩니다. 내가 이것을 실행하려고 할 때. 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 );
다른 팁
오류 메시지가 $ () 생성자에 html이 잘못된 경우 (Firebug에서) 표시됩니다.
$div = $('<div />');
$div.append($div);
제휴하지 않습니다 StackOverflow