low*_*sun 10 jquery image-gallery blueimp
使用Blueimg Gallery我想知道如何总是显示图库控件(.blueimp-gallery-controls),而不是img class=".slide-content"在图库中单击时显示和隐藏它们.
看看blueimp-gallery.min.js(我用在线JavaScript美化器进行了美化,我找到了几个点击处理程序,同时也指示了图库控件的切换功能.
toggleControls: function() {
var a = this.options.controlsClass;
this.container.hasClass(a) ? this.container.removeClass(a) : this.container.addClass(a)
},
Run Code Online (Sandbox Code Playgroud)
在我看来,简单地评论这4行给了我想要的行为.但是我真的不想改变原始脚本.
这样做也会在脚本的这一部分内的Uncaught TypeError: undefined is not a function最后(this.toggleControls())处抛出错误.
f(c.toggleClass) ? (this.preventDefault(b), this.toggleControls()) : f(c.prevClass) ? (this.preventDefault(b), this.prev()) : f(c.nextClass) ? (this.preventDefault(b), this.next()) : f(c.closeClass) ? (this.preventDefault(b), this.close()) : f(c.playPauseClass) ? (this.preventDefault(b), this.toggleSlideshow()) : e === this.slidesContainer[0] ? (this.preventDefault(b), c.closeOnSlideClick ? this.close() : this.toggleControls()) : e.parentNode && e.parentNode === this.slidesContainer[0] && (this.preventDefault(b), this.toggleControls())
Run Code Online (Sandbox Code Playgroud)
, this.toggleControls()从脚本中该行的末尾删除可以消除该错误,但是我认为所有这些都不是正确的方法.
有没有办法在用户添加的脚本中覆盖此脚本中的命令,类似于!importantCSS中的规则?像这样,当Blueimp Gallery有更新时,我可以保留源代码并上传最新版本.
也许作者Sebastian Tschan如果没有被问到太多,可能会联系一下?
任何帮助真的很感激:)
小智 19
将类添加blueimp-gallery-controls到blueimp-gallerydiv使得从开始+切换功能可见的控件仍然有效
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
Run Code Online (Sandbox Code Playgroud)
希望有所帮助.
为了显示控件,您必须将blueimp-gallery-controls类添加到库容器中.
你的容器看起来像这样
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
<div class="slides"></div>
<h3 class="title"></h3>
<a class="prev">‹</a>
<a class="next">›</a>
<a class="close">×</a>
<a class="play-pause"></a>
<ol class="indicator"></ol>
</div>
Run Code Online (Sandbox Code Playgroud)
然后,您可以通过覆盖默认选项来取消绑定单击处理程序.在初始化图库之前覆盖选项很重要.
<script>
blueimp.Gallery.prototype.options.toggleControlsOnReturn = false;
blueimp.Gallery.prototype.options.toggleControlsOnSlideClick = false;
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4244 次 |
| 最近记录: |