How to focus on particular part of a web page by using javascript events?
Let's say I clicked a button and it will scroll down or scroll up to a particular portion a page.
Focus on a particular portion of a web page using javascript
-
- Posts: 106
Focus on a particular portion of a web page using javascript
MarPlo
Hi,
To scroll to a specified element, use the element.scrollIntoView() method (this method scrolls the current element into the visible area of the browser window):
- To scroll to a pixel location, you can use the scrollTop property
To scroll to a specified element, use the element.scrollIntoView() method (this method scrolls the current element into the visible area of the browser window):
Code: Select all
<script>
var element = document.getElementById('elm_id');
element.scrollIntoView();
</script>
Code: Select all
<script>
document.body.scrollTop = 800; // 800 pixels from top of the page
</script>
Similar Topics
-
Link to part of another page (not working)
PHP - MySQL
First post
I`m searching for few hours now but can`t find a solution to link to a part off a page ??? I try to use this...Last post
In one comment-page I have this...
It is strange I tried alot things nothing working correctly.
Meight my Question is wrong, Because I try from a page a link to another page but the... -
SSEP - where determine part of the page
Scripts from this website
First post
Just one more questionLast post
When it displays a part of the pages Content
Where does the script determine where in the page to pull the content from?
I finally finished up the PHP Resources page
And added a few links to this website
Hope that was ok -
SSEP - BUT Cannot save its Page Data
Scripts from this website
First post
Every time I try to index the site it comes back with this message for some of the pages:Last post
BUT Cannot save its Page Data
It indexed 323 pages but...
nice, and nice script, you know what your doing
If you ever want to write a post, article or blog...
Maybe on PHP Resources ?
Id be glad to add it... -
Delete Data without Refreshing Page
JavaScript - jQuery - Ajax
First post
Happy New Year Chief.... My first two weeks I spended on bed due to illnessLast post
I wanna use a script but it does not delete the item from my sql...
O God that I did not see this `stupido me`....
Thank you very much for all the support `its working now` -
SSEP-Multiple Results from a Single Page
Scripts from this website
First post
Hi,Last post
SSEP - Site Search Engine PHP-Ajax is a great script.
I only wish to index a single page and have multiple search results appear for that...
Hi,
Thanks for clarifying that. Not suitable for my purpose, but still an excellent script.
Regards,