简体   繁体   English

滑块卡在第一张幻灯片上

[英]Slider stuck on first slide

I used Anythingslider in my script , it's work with all browsers (FF ,IE) but not working with Chrome and stuck in first slide. 我在脚本中使用了Anythingslider,它适用于所有浏览器(FF,IE),但不适用于Chrome并卡在第一张幻灯片中。

I just change in code to add cute bar and this is my code : 我只是更改代码以添加可爱的栏,这是我的代码:

Widget View: 小部件视图:

        <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/anythingslider.css">    
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.anythingslider.js"></script>


    <!-- Define slider dimensions here -->
    <style>


    /*** Set Slider dimensions here! Version 1.7+ ***/
/* added #slider li to make panels the same size in case "resizeContents" is false */
#slider {
    width: 715px;
    height: 230px;
    list-style: none;
    float: right;
    margin-right: -60px;
  direction: ltr;


}
.anythingSlider {
display: block;
overflow: visible !important;
position: relative;
}
#nav-slider {
    text-align: center;
    float: right;
    margin-top: -20px;

}
#nav-slider ul, #nav-slider span {
    display: inline-block;
    padding-right: 0.3px;
}
#nav-slider li {
    display: inline-block;
    padding: 1px;
}

#nav-slider a {
    display: inline-block;
    width: auto;
    height: 10px;

    padding: 8px;
    text-align: center;
    text-decoration: none;
    color: #999;
    font-size:20px;
}
#nav-slider a:hover { }
#nav-slider a.cur { }
#nav-slider a.start-stop { }
#nav-slider a.start-stop.playing {}



    </style>

        <!-- AnythingSlider initialization -->
    <script>
        // DOM Ready
        $(function(){       

$('#slider').anythingSlider({

    startText           : "<img src='<?php echo Yii::app()->baseUrl ; ?>/images/play.png'>",   // Start button text 
    stopText            : "<img src='<?php echo Yii::app()->baseUrl ; ?>/images/puss.png'>",    // Stop button text 
   forwardText         : "<img src='<?php echo Yii::app()->baseUrl ; ?>/images/prv.png'>", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image) 
   backText            :"<img src='<?php echo Yii::app()->baseUrl ; ?>/images/next.png'>" , // Link text used to move the slider back (hidden by CSS, replace with arrow image) 
    // A HTML element (jQuery Object, selector or HTMLNode) to which the controls will be appended if not null
    appendBackTo: $('#nav-slider span:eq(0)'),
    appendControlsTo: $('#nav-slider span:eq(1)'),
    appendForwardTo: $('#nav-slider span:eq(2)'),


    // Details at the top of the file on this use (advanced use)
    navigationFormatter: function(index, panel) {
        // This is the default format (show just the panel index number)
        return "" + index;
    }
});



});
    </script>






    <!-- END AnythingSlider -->


      <div class="my_footer_block_trainer" >
         <h1 style="text-align: right;">أخبار المدرب</h1>


                <div id="slider">

                <?php 

                $i=3;
                foreach($newse as $value):?>

              <?php if($i % 3==0):?>
              <div>
              <?php  endif;   ?>    
        <table  width="200px"  style=" display:inline;

margin:0;
padding:.9em;
zoom: 1;


 ">
    <tr >
        <td width="200px" style="text-align:center ;">

       <?php echo CHtml::image(Yii::app()->baseUrl."/news_images/".$value->t_img,$value->title,array('width'=>'182px','heghit'=>'182px','style'=>'display: inline-block;'));  ?></td>
    </tr>
    <tr>
        <td width="200px" style="text-align:right ;">

<div class="title" style="display: inline-block;"> <?php echo  CHtml::link($value->title.$i,array('site/news','id'=>$value->news_id));?></div>
</td>
    </tr>
    <tr>
        <td width="200px" style="text-align:center ;">
        <div class="date" style="display: inline-block;">
                <div class="date" style="display: inline-block;"><?php echo $value->p_date ; ?></div>
        <p>&nbsp;</td>
    </tr>
</table>



            <?php $i++;?>  
              <?php if($i % 3 ==0):?>
              </div> 

              <?php   endif;   ?>


            <?php endforeach ;?>
                    </div>     
          <br />
           <?php  echo CHtml::link("مركز الاخبار",array('site/newslist'),array('class'=>'reg-now')); ?>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <div id="nav-slider">
    <span></span>
    <span></span>
    <span></span>

</div>
<br /><br />

            </div>

this test link : http://t.illaf.net/new/trainers/117 该测试链接: http : //t.illaf.net/new/trainers/117

The reason the slider is stuck on the first slide is because it is set up to work with a LTR page. 滑块卡在第一张幻灯片上的原因是因为它被设置为与LTR页面一起使用。

So to make it properly work with a RTL page, you'll need to set the playRtl option to true ( docs ). 因此,为了使其能够与RTL页面一起正常工作,您需要将playRtl选项设置为truedocs )。 This option does several things. 此选项可以完成几件事。

  1. Adds a rtl class name to the outer AnythingSlider wrapper which then applies the following css (the first part is what will fix the slider; the rest is optional and can be removed from the anythingslider.css file) 在外部AnythingSlider包装器中添加一个rtl类名称,然后应用以下CSS(第一部分是修复滑块的内容;其余部分是可选的,可以从anyslider.css文件中删除)

     /* slider autoplay right-to-left */ .anythingSlider.rtl .anythingWindow { direction: ltr; unicode-bidi: bidi-override; } /* move nav link group to left */ .anythingSlider.rtl .anythingControls ul { float: left; } /* reverse order of nav links */ .anythingSlider.rtl .anythingControls ul a { float: right; } /* move start/stop button - in case you want to switch sides */ .anythingSlider.rtl .start-stop { /* float: right; */ } 
  2. In older versions of AnythingSlider, the slider arrows also reversed the direction of the image sliding, including the slideshow; 在任何版本的AnythingSlider中,滑块箭头也会反转图像的滑动方向,包括幻灯片放映。 but this was changed recently (see issue #526 ). 但这是最近更改的(请参阅问题#526 )。

This option still needs some work (again, see the issue linked above), so if all you want to do is just make the slider work and not change the arrow direction or the slideshow, then use this code to only apply the class name ( demo ) 此选项仍然需要做一些工作(再次,请参见上面的链接问题),因此,如果您要做的只是使滑块工作而不改变箭头方向或幻灯片显示,则使用此代码仅应用类名( 演示

$('#slider').anythingSlider({
    playRtl: false,
    onInitialized: function(e, slider) {
        slider.$wrapper.addClass('rtl');
    }
});

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

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