Example of jQuery ScrollBar in scroll bar plug-in

Source: Internet
Author: User

Now, let's briefly summarize the required content.

Step 1: introduce necessary js (jquery. rollbar. min. js, jquery. js)

Step 2: Join the scroll layer

The code is as follows: Copy code

<Div id = "view_screenshort" style = "height: 200px; width: 300px;"> <div class = "content"> <p> phantus 'Major work is the Arithmetica, of which only a portion has specified VED. [8] Fermat's conjecture of his Last Theorem was too red while reading a new edition of the Arithmetica, [9] which was translated into Latin and published in 1621 by clude Bachet. [10]
</P>
<P>
Diophantine equations have been studied for thousands of years. for example, the solutions to the quadratic Diophantine equation x2 + y2 = z2 are given by the Pythagorean triples, originally solved by the Babylonians (c. 1800 BC ). [11] Solutions to linear Diophantine equations, such as 26x + 65y = 13, may be found using the Euclidean algorithm (c. 5th century BC ). [12] Many Diophantine equations have a form similar to the equation of Fermat's Last Theorem from the point of view of algebra, in that they have no cross terms mixing two letters, without sharing its particle properties. for example, it is known that there are inf
</P>
</P>
<P>
In number theory, Fermat's Last Theorem states that no three positive integers a, B, and c can satisfy the equation an + bn = cn for any integer value of n greater than two.
</P>
<P>
This theorem was first conjectured by Pierre de Fermat in 1637, famously in the margin of a copy of Arithmetica where he claimed he had a proof that was too large to fit in the margin. no successful proof was published until 1995 despite the efforts of countless mathematicians during the 358 intervening years. the unsolved problem stimulated the development of algebraic number theory in the 19th century and the proof the modularity theorem in the 20th. it is among the most famous theorems in the history of mathematics and prior to its 1995 proof was in the Guinness Book of World Records for "most difficult math problems ".
Contents
</P>
<P>
1 Fermat's conjecture (History)
2 Mathematical context
2.1 Pythagorean triples
2.2 Diophantine equations
3 Fermat's conjecture
4 Proofs for sp www.111cn.net ecific exponents
5 Sophie Germain
6 Ernst Kummer and the theory of ideals
7 Mordell conjecture 8 Rational exponents


9 Computational studies
</P>
</Div>
</Div>

Step 3: Start special effects

The code is as follows: Copy code


<Script type = "text/javascript">
$ (Document). ready (function (){
$ ('# View_screenshort'). rollbar ({zIndex: 80 });
});
</Script>


In this way, you can simply implement the scroll bar

However, if the content in the middle is an image, scale it proportionally.

For example, the size of the image in the middle is 800X480 or 480X800, but it is displayed that the width is 600 or the height is 600, so proportional scaling is required.

Create a scroll layer first, but hide it first. It is displayed in js later and looks like a transitional effect.

The code is as follows: Copy code


<Div id = "view_screenshort" class = "example" style = "height: 400px; width: 960px; display: none;">
<Div class = "content">
<P> </p>
<P> </p>
<P> </p>
<P> </p>
<P> </p>
<P> </p>
<P> </p>
</Div>
</Div>

Js section

 

The code is as follows: Copy code

<Script type = "text/javascript">
$ (Document). ready (function (){
MakeSize ();
});
Var times = 1;
Function makeSize (){
Var c2 = $ ("# view_screenshort. content"). children (). length;
If (c2> 0 ){
Var fimg = $ ("# view_screenshort. content img"). eq (0); // get the first image
Var I _width, I _height;
$ ("") // Create an img tag in www.111cn.net memory
. Attr ("src", $ (fimg). attr ("src "))
. Load (function (){
// Obtain the true height and width of the image.
I _width = this. width;
I _height = this. height;
Var h2 = 600;
Var w2 = 600;
If (I _width> I _height ){
H2 = w2 * I _height/I _width;
} Else {
W2 = h2/I _height * I _width;
     }
If (h2 = 0 | w2 = 0) & times <8 ){
Times ++;
SetTimeout (function (){
MakeSize ();
}, Times * 500); // try to reload
} Else {
$ ("# View_screenshort"). fadeIn ("slow"); // fades in all matching elements by changing the opacity.
$ ("# View_screenshort. content img" mirror.css ({"width": w2, "height": h2 });
$ ("# View_screenshort" ).css ("height", h2 + 30 );
$ ("# View_screenshort. content" ).css ("width", c2 * (w2 + 30 ));
$ ('# View_screenshort'). rollbar ({zIndex: 80 });
     }
});
  }
 }
</Script>

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.