简体   繁体   English

flexslider-在滑块外部控制div

[英]flexslider - controling div outside of slider

I have been using Flex Slider as a slider plugin for my websites. 我一直在使用Flex Slider作为网站的滑块插件。

I am not super versed in JQuery, but I was wondering if anyone knew of a way to tie the content of another element (in this case an element) to allow for me to change content outside of the flex slider with the same navigation. 我并不精通JQuery,但我想知道是否有人知道一种方法来绑定另一个元素(在本例中为元素)的内容,以允许我使用相同的导航更改flex滑块之外的内容。

I know I can load the content into the 我知道我可以将内容加载到

  • 's and have it slide, but I was wondering if there was a way to change information outside of the slider div. 并使其滑动,但我想知道是否有一种方法可以在滑块div之外更改信息。 Below is my code: 下面是我的代码:

     <article class="slider"> <div class="flexslider-container"> <div class="flexslider"> <ul class="slides"> <li><img class="main" src="/img/banner-boundries.jpg" /></li> <li><img class="main" src="/img/banner-makers.jpg" /></li> <li><img class="main" src="/img/banner-makers.jpg" /></li> </ul><!-- / slides ul --> </div><!-- / flexslider div --> </div><!-- / flexslider-container div --> </article><!-- / slider article --> <article class="slider_sub"> <aside class="column ends"> <p class="quote">“I was really excited to get my new CIRA X. The ability to manage which devices get priority over our 3G network has revolutionized our business.”</p> <hr> <h3>Guy Smiley</h3> <p class="footnote">Muppet Anchor Man, FBI Operative</p> </aside> <aside class="column ends center"> <h2>What Do Makers Do?</h2> <p>Ever wish you had that Thing that made your current devices do that one task you need? We make that Thing. The devices we create are based on solutions for our custmers, not just features.</p> <div class="moreinfo"><a href="">read more</a></div> </aside> <aside class="column ends"> <h2>The CIRA X Story</h2> <img src="img/cira-x-story.png" border="0"> <p>Read how client need drove the cration of this Feeney Wireless device.</p> </aside> <div class="clear"></div> </article><!-- / featurette article --> </section><!-- end call out section --> 

    SO I want the slider navigation to also slide the content below it. 因此,我希望滑块导航也将其下面的内容滑动。 Thanks! 谢谢!

  • There are probably a number of ways to accomplish this. 可能有多种方法可以实现此目的。 This answer is specific to flex-slider. 此答案特定于flex-slider。 The implementation will be very specific to this plugin. 该实现将非常特定于此插件。 There is some pretty good documentation here . 有一些不错的文档在这里

    Theoretically, there are two ways to accomplish this. 从理论上讲,有两种方法可以实现此目的。

    A. Bind the second slider events to listen to the events of the first slider. A.绑定第二个滑块事件以侦听第一个滑块的事件。

    B. Listen to the slide events and programatically call the corresponding events on the second slider. B.听幻灯片事件,并以编程方式调用第二个滑块上的相应事件。 Note, conversion may be required if slide contents do not match 1 to 1. 请注意,如果幻灯片内容不匹配1到1,则可能需要转换。

    A-Solution-- Judging from the documentation, this appears to bind the two together: 解决方案-从文档来看,这似乎将两者绑定在一起:

    <!-- Target both sliders with the same properties -->
    <script type="text/javascript" charset="utf-8">
      $(window).load(function() {
        $('.flexslider').flexslider();
      });
    </script>
    
    //My hesitation on this is that it indicates properties are shared, I am assuming that would included shared event handlers.
    

    B-Solution-- If the two sliders share only properties and not event handlers, the manual (programmatic)method is possible fallback: B解决方案-如果两个滑块仅共享属性而不共享事件处理程序,则可能会使用手动(编程)方法:

    <script type="text/javascript" charset="utf-8">
      $(window).load(function() {
        $('.flexslider').flexslider({
          animation: "slide",
          controlsContainer: ".flex-container",
          before: function(slider) {
            //Grab second slider and pass along action
            $('#secondSliderID').flexslider.before(slider);
          }
        });
      });
    </script>
    

    There may be complication with the slider parameter. 滑块参数可能会很复杂。 Both will involve a bit of plugin specific troubleshooting to confirm. 两者都将涉及一些特定于插件的疑难解答以进行确认。

    Hope this helps. 希望这可以帮助。 All the best! 祝一切顺利! Nash 纳什

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM