如何在Swipbox灯箱中附加自定义HTML?

时间:2018-06-25 12:00:11

标签: jquery html5

我正在为我的一个项目使用swipebox。但是我的客户希望在lighbox视图中添加一个按钮。但是当swipebox创建自己的HTML时,我无法添加它。

我的HTML代码

<div class="my_artwork_slider {{  $project->count() >= 4 ? 'add_slider' : ''  }} owl-carousel owl-theme slider1">  

      @foreach($project->medias as $media)
      @php
      $projectArr = "";
      if(count($media->projects)>0) {
      $projectArr = implode('|',$media->projects->pluck('id')->toArray());
      } else {
      $projectArr = "";
      }
      @endphp

      <div class="item">
           <a href="{{ CMS::imagePath($media->image_name) }}" rel="gallery-1" class="swipebox" title="Fine art"><img src="{{ CMS::imagePath($media->image_name, '370X378') }}" /></a>
           <div class="artwork_caption">
                <div class="artwork_category">Fine art</div>
                <a href="javascript:void(0)" onclick="return openProject({{$media->id}},{{$projectArr}})"><i class="fa fa-heart-o"></i> Add to Project</a>
           </div>
      </div>
      @endforeach
 </div>

我尝试了这段代码

var swipeHtml = $('.my_artwork_slider .swipebox + .artwork_caption a.add2cart');
 $(document).on('click', '.my_artwork_slider a.swipebox', function(){
     $(swipeHtml).appendTo('#swipebox-slider .slide.current');
     console.log(swipeHtml);
 });

0 个答案:

没有答案