如何用滑块上的图片替换视频?

时间:2019-04-15 05:17:18

标签: php html datalife-engine

在滑块上显示4个视频,如果用户使用移动设备进入,则需要替换它,例如以下代码:

     $detect = new Mobile_Detect;
     if($detect->isMobile()){
    echo '<video class="player__video image" width="506" height="506"> 
    $poster="[xfvalue_videopathimage]";                                          
    if($poster=="/templates/assets/images/car.jpg"){
     echo $ec;
  }else if($poster=="/templates/assets/images/health.jpg"){
  echo $tr;
 }else if($poster=="/templates/assets/images/property.jpg"){
  echo $ec;
    }else if($poster=="/templates/assets/images/travel.jpg"){
    echo $tr;
    }
 <source src="[xfvalue_videopathimage]" type="video/jpg">  
     </video>';
      }else{
       echo 
  '<video class="player__video" width="506" height="506"> <source src="[xfvalue_videopath]" type="video/mp4"> Your browser does not support the video tag. </video>';
                                      }

此代码在滑块中显示4个视频,如果不支持视频,则在滑块中显示图片,那么当用户通过移动设备进入时,在滑块中显示图片而不是视频时该怎么办?

html代码:

<section class="hero heron hero--main hero--video" data-carousel-slide="<?echo $ci;$ci++;?>" data-slide-name="<? echo swlang ('[xfvalue_title]', '[xfvalue_title_kk]', '[xfvalue_title_en]');?>">
            <figure class="hero__image"> <img src="<? echo getImageNC(1100, 502, '[xfvalue_backgroundimage]'); ?>" alt=""> </figure>
            <!-- .hero__image -->
            <div class="hero__content">
              <div class="hero__label"> <span><?php echo _("Обратите время вспять");?></span> </div>
              <h1 class="hero__title"><? echo swlang('[xfvalue_title]', '[xfvalue_title_kk]', '[xfvalue_title_en]');?></h1>
              <div class="hero__helptext">
                <p><? echo swlang ('[xfvalue_desc]', '[xfvalue_desc_kk]', '[xfvalue_desc_en]');?></p> <a href="[xfvalue_href]" class="hero__button button button--prime button--square"><?php echo _("Оформить страховку");?></a>                </div>
            </div>
            <div class="hero__player">
              <div class="player">

0 个答案:

没有答案