jquery Control Usage Tutorial

Source: Internet
Author: User

jquery controls are often used during web development. and began to learn a lot of controls in the process, summed up a note, the special assembly, in preparation for their own or friends to learn exchange.

(a) floating Box

Function Introduction: This control can achieve the dynamic positioning of the layer (Four Corners: Upper left, lower left, upper right, right)

The effect shows that when the four buttons are clicked, the floating layer drifts back to the corresponding position.

Operation Steps:

1, add the reference (note the path and their corresponding, file see annex)

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

2. Set CSS style

<style type="text/css">
         #FloatingBox
         {
             border:1px #FF3300 solid;
             width:80px;
             height:100px;
             background-color:#CC9900;
         }
        </style>

3, add the Load function (note should be the corresponding Div ID)

<script type="text/javascript">
  $(document).ready(
      function()
      {
           $('#FloatingBox').floating();
      }
    );
 </script>

4. Add an event function call for four buttons on the DIV layer

<button onclick="javascript:$('#FloatingBox').floatingPosition('left', 'top');">左上</button>
<button onclick="javascript:$('#FloatingBox').floatingPosition('right', 'top');">右上</button><br>
<button onclick="javascript:$('#FloatingBox').floatingPosition('left', 'bottom');">左下</button>
<button onclick="javascript:$('#FloatingBox').floatingPosition('right', 'bottom');">右下</button>

5, congratulations, you can save the viewing effect. Look at the click of the button to locate the layer feel very comfortable?

6, please pay attention to the next article!

This article supporting source code

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.