0
我正在使用div contenteditable = true。它是這樣自動擴展的:http://html5demos.com/contenteditable內容可編輯的div與汽車消耗
但是我需要的是擴展應該是反面意味着,如果我按回車鍵div應該擴展到上邊不要向下邊。
我正在使用div contenteditable = true。它是這樣自動擴展的:http://html5demos.com/contenteditable內容可編輯的div與汽車消耗
但是我需要的是擴展應該是反面意味着,如果我按回車鍵div應該擴展到上邊不要向下邊。
我不確定你可以做到這一點,因爲html文檔從左到右和從上到下擴展,你可以做的是在創建一個新行時向下滾動......這將創建錯覺該股向上擴張。
嘗試在功能附加這樣的:
window.scrollBy(0,fontHeight);
或者這樣使用jQuery:
$('div[contenteditable=true]').animate({
scrollTop: '+=xx' //xx= fontHeight
}, 1000);
你可以看到它在圖像收藏夾Facebook的評論框。 – 2013-04-22 07:40:53