We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

add attribute to image

  • #549
    Avatar photo[anonymous]


    I am trying to use a <span class=”text-gray-dark mr-2″>JavaScript library for zooming images</span>. In the documentation, it says to add the `data-zoomable` attribute to  images, and then use this.
    Where do I add the attribute ? and How do I add `mediumZoom([data-zoomable])`

    I have already imported the library using Custom HTML tool in the app

    ` `

    Can you please suggest  ???? Thanks,


    Avatar photo[anonymous]

    When I post something using the current editor in this forum, the view gets distorted as you can see above.

    But while editing, it does not show like this


    For example, I did not add <span class=”text-gray-dark mr-2…

    but it somehow got added automatically once I submitted the post ?

    Does anyone know why is this happening ?

    Avatar photoBob

    Hi Ajeet,

    It works for me very well: mediumZoom(‘[data-zoomable]’).
    Probably you are pasting a dirty piece of code (html) instead of plain text.

    Avatar photo[anonymous]

    Hi Bob,

    Thanks. I have just copied some code like this `data-zoomable` from github and pasted in the editor. In ticksy, I used to do this, but in here, the WP editor has some issues, I think.

    Reposting the query, if you could help me on that. I am using a js library . Its doc says I need to add `data-zoomable` attribute to images, and then use this code:



    How do I add the attribute ?

    Avatar photoBob

    Do you want to add it to the featured image or to the images into a post?

    Avatar photo[anonymous]

    Only images in the posts..

    Avatar photoBob

    It requires a new helper, so I need to direct you to our new customization service

    You can also try to edit the file helpers.js on your own.

    Avatar photo[anonymous]

    Thanks. I did not know about the helper.js file . I will do