jquery with CSS for accordion components (2)----using SEAJS to realize modularization introduction of static resources

Source: Internet
Author: User

1. Directory Structure (WEBSTROM)

2. Code

1.html

<!     DOCTYPE html>

1.css

. Main {width:1280px;height:300px;background-color: #7FFFD4; float:left;}. Left {Float:left;width:20%;height:80%;background-color:yellow;}. right {float:right;width:80%;height:84%;background-color:lightblue;}. Rightcontent{height:inherit;text-align:center;vertical-align:bottom;}. Lefttop {}.leftbottom {margin-top:60px;}. leftBottom1 {height:60px;background-color: #00FF00; border-top:3px solid #FF0000;}. leftBottom2 {height:60px;background-color: #FF00FF; border-top:3px solid #FF0000;}. LEFTBOTTOM3 {height:60px;background-color: #FFE4E1, border-top:3px solid #FF0000; border-bottom:3px solid #FF0000;}. navdescription {float:left;padding-top:17px;padding-left:95px;}. navimg {float:right;height:100%;cursor:pointer;}. Contentstyle{padding-top:18px;padding-left:70px;cursor:pointer;}

1.js

/** * *///constant object var constent;function toleft () {$ (". Left"). css ({"width": "2.5%"}), $ (". Left. Navdescription"). CSS ({" Display ":" None "}); $ (" img "). attr ({" src ": constent.rightnavimg}), $ (". Right "). CSS ({" width ":" 97.5% "}); $ (" img "). attr ({"onclick": "ToRight ();"});} function ToRight () {$ (". Left"). css ({"width": "20%"}), $ (". Right"). CSS ({"width": "80%"}), $ (". Left. Navdescription"). CSS ({"Display": "Block"}), $ ("img"). attr ({"src": constent.leftnavimg}), $ ("img"). attr ({"onclick": "ToLeft ();"});} function Showleftcontenttoright (content) {var text = $ (content). text (); $ (". Rightcontent"). Text (text);} Seajs.use ("Const/cont.js", Function (cont) {//Initialize constant object constent = Cont.getconstant (); Console.log ("Seajs Use load ... "); $ (document). Ready (The function () {Console.log (" Ready to load ... "), if (constent.leftnavimg = = = $ (" img "). attr (" src ")) {$ (" img "). attr ({" onclick ":" ToLeft (); "});} $ ("#leftBottom1"). attr ({"onclick": "Showleftcontenttoright (' #leftBottom1 ');"}); $ ("#leftBottom2"). attr ({"onclick": "Showleftcontenttoright" (' #leftBottom2 '); "}); $ ("#leftBottom3"). attr ({"onclick": "Showleftcontenttoright (' #leftBottom3 ');"});});  

Cont.js

/** * SEAJS Modular management of static resources (picture path) */define (function (require,exports,module) {function getconstant () {return {"rightnavimg": " Img/toright.png "," leftnavimg ":" Img/toleft.png "};} Module.exports = {getconstant:getconstant};});  

Sea.js Official website: http://seajs.org/docs/#downloads

Jquery-3.0.0.js Official website: http://www.jq22.com/jquery-info122

3. Operation Effect--jquery combined with CSS to implement accordion components

jquery with CSS for accordion components (2)----using SEAJS to realize modularization introduction of static resources

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.