不明白为什么当我试图将PhotoSwipe添加到Rails项目中时,它没有显示任何东西
https://github.com/skakri/photoswipe-rails
我写的代码:
<body>
<!-- some Rails and other stuff -->
<%= render 'shared/photoswipe' %>
</body>end包含从页尾成功添加的div class="pswp“的完整副本。
在单击处理程序上为PhotoSwipe init添加了一些咖啡代码
$ ->
$PhotoContainer = $('#MainPhoto')
$PhotoContainer.click ->
$pswpElement = document.querySelectorAll('.pswp')[0]
$items = []
$('.photo-item').each ->
$Img = $(@)
$items.push( { src: getUrlFromImg($Img).bigImgUrl, w: 1000, h: 1000 } )
$options = {
history: false,
focus: false,
index: 0
}
$gallery = new PhotoSwipe( $pswpElement, PhotoSwipeUI_Default, $items, $options)
$gallery.init()当我单击触发的#MainPhoto容器事件时,$items数组正确地由图像urls和大小填充并调用PhotoSwipe init()函数,但屏幕上没有显示任何内容
发布于 2020-10-20 13:19:31
创业板写得不对应该添加
@import "photoswipe/index";
@import "photoswipe/photoswipe";
@import "photoswipe/default-skin/default-skin";进入application.scss
https://stackoverflow.com/questions/64430618
复制相似问题