【问题标题】:How to Structure Jquery/Html project?如何构建 Jquery/Html 项目?
【发布时间】:2013-07-19 03:17:34
【问题描述】:

我是 Flex / 动作脚本开发人员。我开始学习 Jquery 和 Html。我想使用 jquery 构建项目..

让我以我在 Flex 中的方式给出一些示例。


           Header (separate Mxml /module swf file)

 Contents (separate mxml file / module Swf dynamically loaded. )

    Footer(Separate mxml/module swf file)

如何在 jQuery 和 HTML 中实现相同或类似的模块化概念?

【问题讨论】:

  • 你在 html 中有类似的 head,body 虽然 head 不是标题。您应该将可见内容放在正文中。即正文中的页眉、内容、页脚。 Head 有指向 css 文件、js 文件、标题和 meta tags 的链接。页眉、内容和页脚应该是<body> 的一部分。
  • 欢迎来到 StackOverflow,请阅读帮助部分,了解本网站擅长的问题类型:stackoverflow.com/help。我投票结束这个问题,因为它不是一个可以具体回答的特定编程问题;但更多的是基于意见,很可能会引发辩论。

标签: javascript jquery html apache-flex


【解决方案1】:

你可以试试

<html>

<head>
     <link href="your-css-file" />   
</head>

  <body>

     <header>
        // header contents here
     </header>

     <section id="page" role="main">
       // page contents here
     </section>


     <footer>
         // footer contents here
     </footer>

     <script src="your-js-file"></script>

   </body>

</html>

然后,如果您想为每个部分保留 jQuery,则像这样构建您的 js 文件

$(document).ready(function(){

   headerStuff();
   pageStuff();
   footerStuff();


   function headerStuff(){

      // do header stuff 

   }

   function pageStuff(){

      // do page stuff 

   }

   function footerStuff(){

      // do footer stuff 

   }

});

我建议考虑使用它来获得更好的想法。它已预先设置好,可供您编写代码

http://html5boilerplate.com/

【讨论】:

    猜你喜欢
    • 2010-10-10
    • 2012-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-23
    相关资源
    最近更新 更多