How to display fancybox title only on image hover

前端 未结 2 1619
孤街浪徒
孤街浪徒 2021-01-07 11:10

I\'m using the Fancybox plugin for an image gallery, and I want to display the image titles only when the user hovers over the image. I cannot figure out what part of the co

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-07 11:36

    You don't need to mess with the original js or css files. You just need to create your own custom script and apply there some fancybox API options and methods to achieve that.

    For example, having this html

    open image
    

    you would need a custom script to fire fancybox like:

    
    

    now, within the script above, try the following options for the title effect you want:

    
    

    You could even add some nice animation to show the title like

    
    

    NOTE: this is fancybox v2.x

提交回复
热议问题