jQuery AnythingSlider 插件无法像演示中所示的示例那样工作

发布于 2024-08-05 19:44:13 字数 3933 浏览 3 评论 0原文

我正在使用 AnythingSlider,其操作方式与示例页面的操作方式完全相同,只是示例页面可以正常工作,而我的则不能。

我知道该脚本至少正在运行,因为它创建了一些带有“克隆”类的额外

  • 标记,但没有任何移动。
  • 文档头部的 JavaScript:

    $(function () {
       $('#slider').anythingSlider({
          easing: "swing",           // Anything other than "linear" or "swing" 
                                      // requires the easing plugin
          autoPlay: true,            // turns off the entire FUNCTIONALitY
          startStopped: false,       // force it to start stopped if autoplay is on
          delay: 3000,               // time between slide transitions in AutoPlay
          animationTime: 600,        // time the slide transition takes
          hashTags: true,            // Should links change the hashtag in the URL?
          buildNavigation: false,    // if true builds and 
                                      // list of anchor links to link to each slide
          pauseOnHover: false,       // pause on hover if true and autoPlay enabled
          startText: "Start",        // Start text
          stopText: "Stop",          // Stop text
          navigationFormatter: null  // Details at the top of the file on this use
       });
    });
    
    (jQuery and the plugin are externally called)
    

    HTML

    <div class="container_16 slider" id="slider">
      <div class="wrapper">
          <ul>
              <li>
                  <?php echo html::image('resources/images/featuredweb.gif', array('alt' => ' ', 'class' => 'slider-icon')); ?>
                  <?php echo html::image('resources/images/website.gif', array('alt' => ' ', 'class' => 'imgborder')); ?>
                  <div class="content">
                      <h3>D'Portfolio Theme</h3>
                      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque massa tortor, fermentum ut pellentesque eu, mollis vitae lectus. </p>
                      <strong>Client Name : john doe</strong><br />
                      <strong>Requirement : php / Mysql / Adobe / CSS</strong><br />
                  </div>
              </li>
              <li>
                  <?php echo html::image('resources/images/featuredweb.gif', array('alt' => ' ', 'class' => 'slider-icon')); ?>
                  <?php echo html::image('resources/images/website.gif', array('alt' => ' ', 'class' => 'imgborder')); ?>
                  <div class="content">
                      <h3>D'Portfolio Theme</h3>
                      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque massa tortor, fermentum ut pellentesque eu, mollis vitae lectus. </p>
                      <strong>Client Name : john doe</strong><br />
                      <strong>Requirement : php / Mysql / Adobe / CSS</strong><br />
                  </div>
              </li>
              <li>
                  <?php echo html::image('resources/images/featuredweb.gif', array('alt' => ' ', 'class' => 'slider-icon')); ?>
                  <?php echo html::image('resources/images/website.gif', array('alt' => ' ', 'class' => 'imgborder')); ?>
                  <div class="content">
                      <h3>D'Portfolio Theme</h3>
                      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque massa tortor, fermentum ut pellentesque eu, mollis vitae lectus. </p>
                      <strong>Client Name : john doe</strong><br />
                      <strong>Requirement : php / Mysql / Adobe / CSS</strong><br />
                  </div>
              </li>
          </ul>    
      </div>
    </div>
    

    插件示例页面位于: http://css- tricks.com/examples/AnythingSlider/

    我在这里抓狂了。

    I'm working with AnythingSlider and done it exactly the same as how the example page does it, except the example page is working, and mine isn't.

    I know the script is at least running because it creates some extra <li> tags with the class 'cloned', but nothing is moving.

    JavaScript in the HEAD of the document:

    $(function () {
       $('#slider').anythingSlider({
          easing: "swing",           // Anything other than "linear" or "swing" 
                                      // requires the easing plugin
          autoPlay: true,            // turns off the entire FUNCTIONALitY
          startStopped: false,       // force it to start stopped if autoplay is on
          delay: 3000,               // time between slide transitions in AutoPlay
          animationTime: 600,        // time the slide transition takes
          hashTags: true,            // Should links change the hashtag in the URL?
          buildNavigation: false,    // if true builds and 
                                      // list of anchor links to link to each slide
          pauseOnHover: false,       // pause on hover if true and autoPlay enabled
          startText: "Start",        // Start text
          stopText: "Stop",          // Stop text
          navigationFormatter: null  // Details at the top of the file on this use
       });
    });
    
    (jQuery and the plugin are externally called)
    

    The HTML

    <div class="container_16 slider" id="slider">
      <div class="wrapper">
          <ul>
              <li>
                  <?php echo html::image('resources/images/featuredweb.gif', array('alt' => ' ', 'class' => 'slider-icon')); ?>
                  <?php echo html::image('resources/images/website.gif', array('alt' => ' ', 'class' => 'imgborder')); ?>
                  <div class="content">
                      <h3>D'Portfolio Theme</h3>
                      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque massa tortor, fermentum ut pellentesque eu, mollis vitae lectus. </p>
                      <strong>Client Name : john doe</strong><br />
                      <strong>Requirement : php / Mysql / Adobe / CSS</strong><br />
                  </div>
              </li>
              <li>
                  <?php echo html::image('resources/images/featuredweb.gif', array('alt' => ' ', 'class' => 'slider-icon')); ?>
                  <?php echo html::image('resources/images/website.gif', array('alt' => ' ', 'class' => 'imgborder')); ?>
                  <div class="content">
                      <h3>D'Portfolio Theme</h3>
                      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque massa tortor, fermentum ut pellentesque eu, mollis vitae lectus. </p>
                      <strong>Client Name : john doe</strong><br />
                      <strong>Requirement : php / Mysql / Adobe / CSS</strong><br />
                  </div>
              </li>
              <li>
                  <?php echo html::image('resources/images/featuredweb.gif', array('alt' => ' ', 'class' => 'slider-icon')); ?>
                  <?php echo html::image('resources/images/website.gif', array('alt' => ' ', 'class' => 'imgborder')); ?>
                  <div class="content">
                      <h3>D'Portfolio Theme</h3>
                      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque massa tortor, fermentum ut pellentesque eu, mollis vitae lectus. </p>
                      <strong>Client Name : john doe</strong><br />
                      <strong>Requirement : php / Mysql / Adobe / CSS</strong><br />
                  </div>
              </li>
          </ul>    
      </div>
    </div>
    

    The plugin example page is here: http://css-tricks.com/examples/AnythingSlider/

    I'm tearing my hair out here.

    如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

    扫码二维码加入Web技术交流群

    发布评论

    需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

    评论(1

    伤感在游骋 2024-08-12 19:44:13

    我自己没有使用过 AnythingSlider 插件,但我确实注意到你的类属性与他们的不同。

    你有:

     <div class="container_16 slider" id="slider">
    

    并且他们已经

     <div class="anythingSlider">
    

    尝试将你的(和相关的CSS)更改为

     <div class="container_16 anythingSlider" id="slider">
    

    或者

     <div class="container_16 slider anythingSlider" id="slider">
    

    我用他们的CSS(而不是你的)测试了你的html并且它正在工作。内容正在按预期进行。

    我建议采用他们的示例 css 并将其修改为您想要的样式,因为该插件似乎依赖于它。

    I've not used the AnythingSlider plugin myself, but I do notice that your class attribute is different from theirs.

    you have:

     <div class="container_16 slider" id="slider">
    

    and they have

     <div class="anythingSlider">
    

    Try changing yours (and related css) to

     <div class="container_16 anythingSlider" id="slider">
    

    or

     <div class="container_16 slider anythingSlider" id="slider">
    

    I tested your html with their css (instead of yours) and it is working. The content is moving as expected.

    I'd recommend taking their example css and modifying it to the style you want as the plugin seems to depend on it.

    ~没有更多了~
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文