jQuery Scroll To Top Css Button OnClick - jQuery Example

3 Comments | 5576 Views | Post by: Admin | Tags: jQuery Scroll to top, jQuery Examples, jQuery Trick


In Websites, We see the "Back to Top" or "Scroll To Top" buttons on the websites are very helpful for web users "Back To Top" button is used to facilitate the readers if the readers want to scroll the


In Websites, We see the "Back to Top" or "Scroll To Top" buttons on the websites are very helpful for web users "Back To Top" button is used to facilitate the readers if the readers want to scroll the page up if the page length is greater than 2 or more pages.

If the webpage length is too long then, it is a good idea tp provide users with easy way to quickly automatically scroll back to the top of the page.

 In this article I will cover jQuery scroll position, jquery back to top, jQuery scroll to top of page, html button onclick jQuery example.

So lets starts the coding.

(note: you can download the running source codes at the end of the article)


Step 1: Create a New Website in Visual Studio 2010.
 

Step 2: Add a new WebForm(Default.aspx) with the following codes.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>


"en">"utf-8">Demo - ASP.Net - jQuery Scroll To Top Button onClick CSS Example "css/css.css" rel="stylesheet" />

"top">

"pagewrap">

Demo

Animated jQuery Scroll To Top

Carsten Borchgrevink (18641934) was an Anglo-Norwegian polar explorer and a pioneer of modern Antarctic travel. He was the precursor of Robert Falcon Scott, Ernest Shackleton, Roald Amundsen and others associated with the Heroic Age of Antarctic Exploration. He began his exploring career in 1894 by joining a Norwegian whaling expedition, from which he brought back a collection of the first specimens of vegetable life within the Antarctic Circle. From 1898 to 1900 Borchgrevink led the British-financed Southern Cross Expedition, which in 1899 became the first to overwinter on the Antarctic mainland and the first to visit the Great Ice Barrier since the expedition of Sir James Ross nearly sixty years previously. Borchgrevink landed on the Barrier with two companions and made the first sledge journey on its surface, setting a new Farthest South record at 78°50'S. He was one of three scientists sent to the Caribbean in 1902 by the National Geographic Society to report on the aftermath of the Mount Pelée disaster. His pioneering work was recognised and honoured by several countries, and in 1912 he received a handsome tribute from Roald Amundsen, conqueror of the South Pole. (Full article...) Recently featured: Natchez revolt – George Robey – Elwyn Roy King

Carsten Borchgrevink (18641934) was an Anglo-Norwegian polar explorer and a pioneer of modern Antarctic travel. He was the precursor of Robert Falcon Scott, Ernest Shackleton, Roald Amundsen and others associated with the Heroic Age of Antarctic Exploration. He began his exploring career in 1894 by joining a Norwegian whaling expedition, from which he brought back a collection of the first specimens of vegetable life within the Antarctic Circle. From 1898 to 1900 Borchgrevink led the British-financed Southern Cross Expedition, which in 1899 became the first to overwinter on the Antarctic mainland and the first to visit the Great Ice Barrier since the expedition of Sir James Ross nearly sixty years previously. Borchgrevink landed on the Barrier with two companions and made the first sledge journey on its surface, setting a new Farthest South record at 78°50'S. He was one of three scientists sent to the Caribbean in 1902 by the National Geographic Society to report on the aftermath of the Mount Pelée disaster. His pioneering work was recognised and honoured by several countries, and in 1912 he received a handsome tribute from Roald Amundsen, conqueror of the South Pole. (Full article...) Recently featured: Natchez revolt – George Robey – Elwyn Roy King

Carsten Borchgrevink (18641934) was an Anglo-Norwegian polar explorer and a pioneer of modern Antarctic travel. He was the precursor of Robert Falcon Scott, Ernest Shackleton, Roald Amundsen and others associated with the Heroic Age of Antarctic Exploration. He began his exploring career in 1894 by joining a Norwegian whaling expedition, from which he brought back a collection of the first specimens of vegetable life within the Antarctic Circle. From 1898 to 1900 Borchgrevink led the British-financed Southern Cross Expedition, which in 1899 became the first to overwinter on the Antarctic mainland and the first to visit the Great Ice Barrier since the expedition of Sir James Ross nearly sixty years previously. Borchgrevink landed on the Barrier with two companions and made the first sledge journey on its surface, setting a new Farthest South record at 78°50'S. He was one of three scientists sent to the Caribbean in 1902 by the National Geographic Society to report on the aftermath of the Mount Pelée disaster. His pioneering work was recognised and honoured by several countries, and in 1912 he received a handsome tribute from Roald Amundsen, conqueror of the South Pole. (Full article...) Recently featured: Natchez revolt – George Robey – Elwyn Roy King

Carsten Borchgrevink (18641934) was an Anglo-Norwegian polar explorer and a pioneer of modern Antarctic travel. He was the precursor of Robert Falcon Scott, Ernest Shackleton, Roald Amundsen and others associated with the Heroic Age of Antarctic Exploration. He began his exploring career in 1894 by joining a Norwegian whaling expedition, from which he brought back a collection of the first specimens of vegetable life within the Antarctic Circle. From 1898 to 1900 Borchgrevink led the British-financed Southern Cross Expedition, which in 1899 became the first to overwinter on the Antarctic mainland and the first to visit the Great Ice Barrier since the expedition of Sir James Ross nearly sixty years previously. Borchgrevink landed on the Barrier with two companions and made the first sledge journey on its surface, setting a new Farthest South record at 78°50'S. He was one of three scientists sent to the Caribbean in 1902 by the National Geographic Society to report on the aftermath of the Mount Pelée disaster. His pioneering work was recognised and honoured by several countries, and in 1912 he received a handsome tribute from Roald Amundsen, conqueror of the South Pole. (Full article...) Recently featured: Natchez revolt – George Robey – Elwyn Roy King

Carsten Borchgrevink (18641934) was an Anglo-Norwegian polar explorer and a pioneer of modern Antarctic travel. He was the precursor of Robert Falcon Scott, Ernest Shackleton, Roald Amundsen and others associated with the Heroic Age of Antarctic Exploration. He began his exploring career in 1894 by joining a Norwegian whaling expedition, from which he brought back a collection of the first specimens of vegetable life within the Antarctic Circle. From 1898 to 1900 Borchgrevink led the British-financed Southern Cross Expedition, which in 1899 became the first to overwinter on the Antarctic mainland and the first to visit the Great Ice Barrier since the expedition of Sir James Ross nearly sixty years previously. Borchgrevink landed on the Barrier with two companions and made the first sledge journey on its surface, setting a new Farthest South record at 78°50'S. He was one of three scientists sent to the Caribbean in 1902 by the National Geographic Society to report on the aftermath of the Mount Pelée disaster. His pioneering work was recognised and honoured by several countries, and in 1912 he received a handsome tribute from Roald Amundsen, conqueror of the South Pole. (Full article...) Recently featured: Natchez revolt – George Robey – Elwyn Roy King


Step 3: Create a folder with name "CSS" at the root of the website and write the following codes in CSS.CSS file

body {
    font: .88em/150% Arial, Helvetica, sans-serif;
    margin: 30px auto;
}

h1 {
    font: bold 80%/120% Arial, Helvetica, sans-serif;
    text-transform: uppercase;
    margin: 0 0 10px;
    color: #999;
}

h2 {
    font-size: 2.5em;
    margin: 0 0 8px;
}

h3 {
    font-size: 1.6em;
    margin: 20px 0 5px;
}

a {
    color: #69C;
    text-decoration: none;
}

    a:hover {
        color: #F30;
    }

p {
    margin: 0 0 10px;
}

em {
    font: italic 100% "Times New Roman", Times, serif;
}

.credits {
    border-bottom: solid 1px #eee;
    padding-bottom: 10px;
    margin: 0 0 30px;
}

#pagewrap {
    margin: 0 auto;
    width: 600px;
    padding-left: 150px;
    position: relative;
}

/*
Back to top button
*/
#back-top {
    position: fixed;
    bottom: 30px;
    margin-left: -150px;
}

    #back-top a {
        width: 108px;
        display: block;
        text-align: center;
        font: 11px/100% Arial, Helvetica, sans-serif;
        text-transform: uppercase;
        text-decoration: none;
        color: #bbb;
        /* background color transition */
        -webkit-transition: 1s;
        -moz-transition: 1s;
        transition: 1s;
    }

        #back-top a:hover {
            color: #000;
        }
    /* arrow icon (span tag) */
    #back-top span {
        width: 108px;
        height: 108px;
        display: block;
        margin-bottom: 7px;
        background: #ddd url(../images/top4.jpg) no-repeat center center;
        /* rounded corners */
        -webkit-border-radius: 15px;
        -moz-border-radius: 15px;
        border-radius: 15px;
        /* background color transition */
        -webkit-transition: 1s;
        -moz-transition: 1s;
        transition: 1s;
    }

    #back-top a:hover span {
        background-color: #777;
    }

So, In this tutorial we have learned how to jQuery Scroll To Top Css Button OnClick - jQuery Example. Hope you have enjoyed this tutorial.

 

 

 

 

 

Download Source Codes


Post Comments

if you have some suggestion, question, request on jQuery Scroll To Top Css Button OnClick - jQuery Example.

Please use the comment box to express your views.

 

Comments:

loading...