Site logo

[Resolved] Load video only on click like that on generatepress.com

Home Forums Support [Resolved] Load video only on click like that on generatepress.com

Home Forums Support Load video only on click like that on generatepress.com

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #689888
    Leon

    Hi Tom,

    I’m wondering if it’s possible for you to share how you make the videos load on click only.

    I guess you just put an image with a play icon.

    But how do you make this happen: after clicking the image, the video will play in a popup window?

    Thank you in advance.
    Leon

    #690093
    Tom
    Lead Developer
    Lead Developer

    We used this jQuery library: https://github.com/jsor/lity

    If you’re not comfortable setting up a library like that, a plugin like this might help: https://wordpress.org/plugins/wp-featherlight/

    #690112
    Leon

    Thank you Tom. Made it with featherlight.

    Cheers~

    #690321
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

    #986345
    Roman

    Hi Tom, I have managed to run Lity on my website. I would like to ask you for help with following issue. Lity needs ‘data-lity’ attribute inside the <a> tag. It is not a problem to insert it manually while creating a link, but I would like to use Lity for images inserted in the post through the ‘insert media’ dialog box. I have been trying hard to setup some filter or hook to automatically add ‘data-lity’ inside the image link tag (both for new and already uploaded images). Could you point me to the right direction please? I think the solution might by somewhere around wp core caption shortcode…

    #986659
    Tom
    Lead Developer
    Lead Developer

    I wonder if something like this will work?: https://wordpress.stackexchange.com/a/222442

    #986972
    Roman

    Tank you, Tom. The filter image_send_to_editor works, but only for media uploaded in the wordpress media library. It seems that wordpress uses another function to create image links for media added from external URLs. Any ideas?

    #987378
    Tom
    Lead Developer
    Lead Developer

    Strange, I would think that filter would work regardless of where the image is coming from, as they all get added to the editor.

    Other than that, you might need to find some code that filters the_content, but that might be somewhat buggy.

    Maybe this?: https://gist.github.com/ControlledChaos/0f91329cafff8d778cd0b176a7a6abbb

    #1040602
    Nick

    Edit: Figured out how to get Lity working no reply needed.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Load video only on click like that on generatepress.com’ is closed to new replies.