在PHP中调用外部JS链接

时间:2017-12-29 02:45:11

标签: javascript php css css3 page-flipping

我有3个文件用于css,js和php(更多关于html但我决定改用php扩展名) 我试图制作的项目是一个具有翻页动作的交互式菜单。我能够在codepen中找到一个引用。但是,当我尝试将它应用到我的结尾时,动画和文本不能按照我需要的方式运行,尽管它适用于codepen

我使用的代码也可以在上面提到的链接上找到。我只是想问一下如何正确调用menu.php文件中的外部链接https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.jshttps://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenMax.min.js

这就是我在sublimetext上做到的。我不确定它是否仅仅是我文件的定位。我所做的结果是所有文本都居中,没有页面翻转。谢谢你的帮助

Menu.php

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Sakurajima Menu</title>
  <link href="css/styles2.css" rel="stylesheet">
  <script src="js/main2.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenMax.min.js"></script>
  <link rel="shortcut icon" type="image/png" href="img/sakura-favicon.png"/>
</head>
<body>
      <div class="container">
        <div class="book-wrapper">
          <div class="book-cover">
            <img src="https://github.com/slyka85/assets/blob/master/bookcover2.png?raw=true" alt="">
          </div>
          <div class="pages-container">
            <div class="pages">
              <div class="page-num-1">
                <div class="pages-content">
                  <div class="pages-background"></div>
                  <div class="content-inner">
                    <h1>Chapter 1</h1>
                    <div class="text"><p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptas ea non vitae a assumenda sint quod, dolores laboriosam velit corrupti nobis cupiditate perspiciatis natus exercitationem, architecto esse ratione blanditiis! Itaque.</p></div>
                  </div>
                </div>
              </div>
              <div class="page-num-2">
                <div class="pages-content">
                  <div class="content-inner">
                    <h1>Chapter 2</h1>
                    <div class="text">
                      <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Eos, cumque autem! Magni eligendi qui officiis? Fugit iste voluptatum atque voluptatibus totam! Nisi accusantium saepe hic. Aut nobis nesciunt mollitia error.</p>
                        <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Quibusdam odio modi, hic ratione fugit quod natus, excepturi quae minus voluptatum cupiditate quia magnam eveniet ex, reiciendis voluptates ipsam iste laudantium!</p>
                      <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Obcaecati deserunt magnam, at perspiciatis aut. Voluptatem consequuntur neque quisquam?</p>
                      </div>
                  </div>
                </div>

              </div>
              <div class="page-num-3">
                <div class="pages-content">
                  <div class="content-inner">
                    <h1>Chapter 3</h1>
                    <div class="text"><p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptate voluptas molestiae tempore amet adipisci dicta incidunt nisi alias distinctio fugit blanditiis dignissimos nobis deserunt eum consequuntur ipsam, perspiciatis numquam repellendus.</p>
                      <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Delectus in odio deserunt est hic minima inventore, mollitia, officia aspernatur eaque voluptatibus? Amet, molestias adipisci delectus ea eligendi sit numquam illo.</p>
                    </div>
                  </div>
                </div>
              </div>
              <div class="page-num-4">
                <div class="pages-content">
                  <div class="content-inner">
                    <h1>The End</h1>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

      </div>
</body>
</html>

1 个答案:

答案 0 :(得分:2)

首先放置供应商库

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenMax.min.js"></script>
<script src="js/main2.js" type="text/javascript"></script>