Content Editor Webpart (2) Add JQuery and html code

Source: Internet
Author: User

Content Editor Webpart (2) Add JQuery and html code

In the previous article (Content Editor Webpart (1) referencing JQuery), we introduced how to reference JQuery in Content Editor Webpart, this article introduces how to add html and JQuery code in the Content Editor Webpart.

Follow the previous step to edit the source code of the Content Editor Webpart and enter the following code:

<div style="height: 200px;"><script type="text/javascript" src="/sites/apps/Style%20Library/jquery-1.10.2.min.js"></script><script> $(document).ready(function(){    $("#btnStr").click(function(){        $("#move").animate({left: '250px'});    });});</script><button id="btnStr" onclick="moveDiv()">Start Animation</button><p>By default, all HTML elements have a static position, and cannot be moved.       <br/>To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</p><div id="move" style="height: 100px; width: 100px; position: absolute; background: #98bf21;"></div> </div>


 

After saving, it is displayed as follows:

Click Start Animation to move the green div block:

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.