带有id的JQuery图像查看器?

时间:2014-01-14 07:54:13

标签: jquery html

我想将iviewer与图片ID一起使用。有可能吗?

<script type="text/javascript">
    var $ = jQuery;
    $(document).ready(function(){
          var iv1 = $("#viewer").iviewer({
                src: "test_image.jpg", ------> here I would like to put image id. "#image_1"
                update_on_resize: false,
                zoom_animation: false,
                mousewheel: true,
                onMouseMove: function(ev, coords) { },
                onStartDrag: function(ev, coords) { return false; }, //this image will not be dragged
                onDrag: function(ev, coords) { }
          });
    });
</script>

<div id="viewer" class="viewer">
    <img src="test_image.jpg" id="image_1"/>
</div>

1 个答案:

答案 0 :(得分:0)

尝试使用它:

src: $("#viewer").find('img').attr('id') + ".jpg"