0

私たちは次のサイトに取り組んでいます: 検索結果ページに多くのまたは動的なフレーバーを出力するIDXプラグインを備えた www.granthammond.com 、http: //granthammond.com/idx/mls-1385061-8788_highway_70_nashville_tn_37221

いくつかのjQueryを使用してDOMの一部を移動しています。具体的には、#source-ordered-content#dsidx-disclaimerを使用.removeしています。とを使用していると.prepend、エラーが発生します: uncaught typeerror, object has no method .prepend 奇数。私は以前にこの種のことをしたことがあると確信していますが、今回は明らかにそれを正しく行っていません。私のjQueryスキルは明らかに昼食に出ています。

これがホラー、えー、コードです:

jQuery(document).ready(function($) {

// do_stuff
var socHeight;
var socDiv;
var socContent;
var dsidxDisclaimer;

// get height of source ordered content
socHeight = $("#source-ordered-content").height();
wrapHeight = $("#wrap").height();

//console.log( 'socHeight: ' + socHeight );
//console.log( 'wrapHeight: ' + socHeight );

$("#content").css({
     'height': socHeight
});

// or, for IDX data pages, 

socContent = $(".page-dsidxpress-data #source-ordered-content").remove();
$("#content").prepend(socContent);

//move the disclaimer down into the footer.
dsidxDisclaimer = $(".page-dsidxpress-data #dsidx-disclaimer").remove();
$("#footer").append(dsidxDisclaimer);

}); // end (document).ready()

もう一度スタックに感謝します。

4

1 に答える 1

0

使い方が間違っています。

現在のコードに追加および追加しているのは、要素ではなく要素の削除であり、機能しません。これが機能するコードであるとは言いませんが(jsfiddleを提供していないため)、次のようになります。

socContent = $(".page-dsidxpress-data #source-ordered-content")
socContent.remove();
$("#content").prepend(socContent);

//move the disclaimer down into the footer.
dsidxDisclaimer = $(".page-dsidxpress-data #dsidx-disclaimer");
dsidxDisclaimer.remove();
$("#footer").append(dsidxDisclaimer);
于 2012-08-08T16:36:43.527 に答える