JQuery back to the top plug-in jQuery GoUp, jquerygoup

Source: Internet
Author: User

JQuery back to the top plug-in jQuery GoUp, jquerygoup

Plug-in description

JQuery GoUp! Is a simple jQuery plug-in that allows your webpage users to directly return to the top.


Easy to use

Reference jquery library and jquery. goup. min. js to your page

<script type="text/javascript" src="jquery.min.js"></script><script type="text/javascript" src="jquery.goup.min.js"></script>

After the plug-in is called, it will be OK.

<Script type = "text/javascript"> $ (document ). ready (function () {$. goup ({trigger: 100, bottomOffset: 20, // The offset locationOffset: 30 from the bottom, // The offset from the right: 'back to the top', titleAsText: true // whether the title is displayed}); </script>

Effect


JQuery GoUp: http://download.csdn.net/detail/itmyhome/7714581



How to Use the jquery plug-in on the top of the rocket return?

Hello, This jquery plug-in is used in this way!

1. Import the jquery.js and top.js?cssfile top.css To Your webpage.

2. Add a line of html code to Your webpage: <a id = "returnTop" href = "javascript:;"> back to the top </a>

That's all!

Note: if you look at the content of top. js, you will understand why the id of the <a> label added is "returnTop.
Of course, you can change this id on your own, but remember to synchronize.

Bytes --------------------------------------------------------------------------------------------------

Add callback for jquery plug-in development

Your plug-in should not return with return, because you do not need to get a value, but directly set CSS

Var _ this = $ (this) is unnecessary.

(Function ($ ){
$. Fn. MyCss = function (options, callback ){
Var defaults = {
Bd: '#000 ',
Cl: 'red'
};
Var opts = $. extend (defaults, options );
$ (This). each (function (){
Background (this).css ({'background ': opts. bd, 'color': opts. cl });
});
If (callback ){
Callback ();
}
};
}) (JQuery );

When callback is used, the subsequent function is the callback function.

$ (Function (){
$ ("# Foo,. bar"). MyCss ({}, function (){
Alert ("CSS setting successful ");
});
});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.