ElevateZoom don't work in bootstrap modal

倾然丶 夕夏残阳落幕 提交于 2019-12-19 22:10:09

问题


I use the ElevateZoom jQuery plugin for photo zooming (http://www.elevateweb.co.uk/image-zoom/examples). It works fine, but when I show an image in a bootstrap modal the zooming doesn't work anymore.

Does anybody know how I can let the zooming work in a bootstrap modal?

Example of the code: http://ec-auditfile.nl/demo.html


回答1:


Your zoom is working, it's just hidden behind your modal.

Adjust z-index of your zoomed image to be over the modal.

    .zoomContainer{ z-index: 9999;}
    .zoomWindow{ z-index: 9999;}

You may also need to add .elevateZoom() function as a callback to modal show event

Example (using Bootstrap 3)

$(document).ready(function () {
    $('#myModal').on('shown.bs.modal', function() {
        $("#zoom_05").elevateZoom({
            zoomType: "inner",
            cursor: "crosshair"
        });
    })
});


来源:https://stackoverflow.com/questions/22742159/elevatezoom-dont-work-in-bootstrap-modal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!