簡體   English   中英

如何將 jQuery 中的 scrollTop 轉換為 JavaScript?

[英]How can i convert scrollTop in jQuery to JavaScript?

我需要將 jQuery 中的 scrollTop 轉換為 JavaScript: 這是我的代碼:

const scrollToBottom = () => {
   let locationPage = document.querySelector('.main__chat_window');
   locationPage.scrollTop(locationPage.prop("scrollHeight"));
}

我在“(locationPage.prop(“scrollHeight”)”中的問題,高度在我的項目中更新。

ScrollHeight 是一個只讀屬性。 可以直接賦值給scrollTop,srollTop不是方法而是屬性。

 function scrollToBottom() { const container = document.querySelector("div") container.scrollTop = container.scrollHeight; } scrollToBottom();
 div { height: 200px; width: 200px; overflow: auto; }
 <div> Before you can begin to determine what the composition of a particular paragraph will be, you must first decide on an argument and a working thesis statement for your paper. What is the most important idea that you are trying to convey to your reader? The information in each paragraph must be related to that idea. In other words, your paragraphs should remind your reader that there is a recurrent relationship between your thesis and the information in each paragraph. A working thesis functions like a seed from which your paper, and your ideas, will grow. The whole process is an organic one—a natural progression from a seed to a full-blown paper where there are direct, familial relationships between all of the ideas in the paper. The decision about what to put into your paragraphs begins with the germination of a seed of ideas; this “germination process” is better known as brainstorming. There are many techniques for brainstorming; whichever one you choose, this stage of paragraph development cannot be skipped. Building paragraphs can be like building a skyscraper: there must be a well-planned foundation that supports what you are building. Any cracks, inconsistencies, or other corruptions of the foundation can cause your whole paper to crumble. So, let's suppose that you have done some brainstorming to develop your thesis. What else should you keep in mind as you begin to create paragraphs? Every paragraph in a paper should be: Unified: All of the sentences in a single paragraph should be related to a single controlling idea (often expressed in the topic sentence of the paragraph). Clearly related to the thesis: The sentences should all refer to the central idea, or thesis, of the paper (Rosen and Behrens 119). Coherent: The sentences should be arranged in a logical manner and should follow a definite plan for development (Rosen and Behrens 119). Well-developed: Every idea discussed in the paragraph should be adequately explained and supported through evidence and details that work together to explain the paragraph's controlling idea (Rosen and Behrens 119). </div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM