Flexslider - How to make two slider functioning together (images and a paragraph text) using a single directionNav?

天大地大妈咪最大 提交于 2019-12-11 19:54:09

问题


My mark up is

        <div class="slide_container">
             <div class='bg_container'>
                <div id='bg_slider' class='flexslider' >
                    <ul id='slide_set' class='slides'>
                        <li>image 1</li>
                        <li>image 2</li>
                        <li>image 3</li>
                        <li>image 4</li>            
                    </ul>
                    <div id='glass_div'></div> 
                </div>                    
            </div>
            <div class='tex_slide_container'>
                <div id='message' class='flexslider2'>
                    <ul id='content_slide_holder' class='slides'>
                        <li>
                            <div class='text_holder'>  
                                <div class='text_div'>text 1</div>
                            </div>                            
                        </li>
                        <li>
                            <div class='text_holder'>  
                                <div class='text_div'>text 1</div>
                            </div>                           
                        </li>
                        <li>
                            <div class='text_holder'>  
                                <div class='text_div'>text 1</div>
                            </div>                        
                        </li>
                        <li>
                            <div class='text_holder'>  
                                <div class='text_div'>text 1</div>
                            </div>                         
                        </li>   
                    </ul>    
                </div>                    
            </div>                    
        </div>

*My JS script is : *

<script type="text/javascript">
    $(window).load(function() {
        $("#slide_row").show();
        var count = 0 ; 
        $("#loaing_animation").hide();

        $('.flexslider').flexslider(
        {
            animation: "slide",
            animationSpeed: 4000,
            easing: "swing",
            slideshowSpeed: 10000,
            touch:false,
            before: function(){
                if(count == 1 ){
                    $('#static_path').attr('id','moving_path');
                    $('.empty_wings').attr('class','wings');
                    $('.empty_body').attr('class','birdbody');
                }
                count++;                                              
            },
            after: function(){
            },controlNav: false,
            directionNav: true


        }           
    );
        $('.flexslider2').flexslider(
        {
            animation: "slide",
            animationSpeed: 2500,
            easing: "swing",
            slideshowSpeed: 10000,
            touch:false,
            before: function(){
            },
            after: function(){
            },
            controlNav: false,
            directionNav: true
        }           
    );          
    });
</script>

my css is : here

I am not willing to change the mark up.

The situation is after I enable the directionNav if I click the Nav button the images are sliding, not the paragraph.

I am trying to slide both texts (text holder) and the image together.

How can I do that? Any help will be appreciated.


回答1:


You need to implement your own nex/prev (u can add navigator image etc as per ur requirement these is just for demo how nex/prev can work.) As if 2 flexslider navigation html will be conflict. and only one will be navigate.

Fiddle DEMO

  $("#next").on("click" , function (e) { 
     var $slider = flex1.data('flexslider');        
    $slider.flexAnimate($slider.getTarget("next"), true);  
    var $slider = flex2.data('flexslider');
     $slider.flexAnimate($slider.getTarget("next"), true);     
  });

  $("#prev").on("click" , function (e) { 
     var $slider = flex1.data('flexslider');        
    $slider.flexAnimate($slider.getTarget("prev"), true);  
    var $slider = flex2.data('flexslider');
     $slider.flexAnimate($slider.getTarget("prev"), true);     
  });


来源:https://stackoverflow.com/questions/22345782/flexslider-how-to-make-two-slider-functioning-together-images-and-a-paragraph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!