Skip to content

mediumZoom and Wordpress/Divi builder issueΒ #211

Open
@mmattel

Description

@mmattel

Bug description

Trying to make mediumZoom working in the Divi builder I stumble over one issue.

Working Example:

When running mz with Antora (a documentation framework), you add it via

...
var Mzm = (window.mzm = require('medium-zoom/dist/medium-zoom.min'))
Mzm('span.image img, div.imageblock img', { background: '#fff', margin: 10 })
...

Which results in a working zoomable image, example with the following code from the inspector:

<div class="imageblock">
  <div class="content">
  <img src="../_images/architecture/infinite_scale_data_platform.svg" alt="Infinite Scale Data Platform" width="500" class="medium-zoom-image">
  </div>
</div>

Failing Example with Divi:

Loading the library and initializing mediumZoom:

<script src="https://unpkg.com/[email protected]/dist/medium-zoom.js">
</script>

<script>
jQuery(document).ready(function( $ ) {
	mediumZoom($('div.data-zoomable, img').toArray());
});
</script>

Note, using [data-zoomable] did not work...

Adding data-zoomable to the image CSS Class to make it zoomable.

This is the code from the inspector:

<div class="et_pb_module et_pb_image et_pb_image_0 data-zoomable">
  <span class="et_pb_image_wrap ">
    <img fetchpriority="high" decoding="async" width="740" height="900" 
     src="https://dev.innovation-und-beratung.com/storage/2020/04/innovation-ok-with-failing-procedure.png" 
     alt="innovation ok with failing procedure" title="Comfortable with failing procedures" 
     srcset="https://dev.innovation-und-beratung.com/storage/2020/04/innovation-ok-with-failing-procedure.png 
     740w, https://dev.innovation-und-beratung.com/storage/2020/04/innovation-ok-with-failing-procedure- 
     480x584.png 480w" sizes="(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 740px, 100vw" 
     class="wp-image-24617 medium-zoom-image">
  </span>
</div>

Now, the following happens:

  • The mouse changes to the + symbol when hovering. βœ”οΈ
  • When clicking on the image:
    • medium-zoom-image--hidden is added to the class containing medium-zoom-image βœ”οΈ
    • The clicked image disappears as per hidden βœ”οΈ
    • But nothing else happens - there is no zoomed image shown πŸ’₯
  • Scrolling the screen makes the original image re-appear βœ”οΈ

I can provide you a temproary view access to my dev site if required.

Expected behavior

mediumZoom should show the zoomed image when using the Divi builder.

Environment

  • Browser: Opera, Firefox, Chrome, always latest
  • medium-zoom version: 1.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions