لا يمكن إدراج العقدة في النقطة المحددة في رمز التسلسل الهرمي "رمز:" 3

StackOverflow https://stackoverflow.com/questions/1119211

  •  12-09-2019
  •  | 
  •  

سؤال

مهلا، أنا مرة أخرى مع سؤال حول مسج وهذا gridlayout. لقد صنعت قالب 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>

يتم تحميل البرنامج النصي المسج والجدل في الرأس. عندما أحاول تشغيل هذا. 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 );

نصائح أخرى

يتم عرض رسالة الخطأ (في Firebug) إذا كان لديك HTML غير صحيح في منشئ $ ()، وكذلك عند محاولة إلحاق عقدة بحد ذاته، على سبيل المثال:

$div = $('<div />');
$div.append($div);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top