0
<script type="text/javascript">
 $(document).ready(function () {

         var zoomid;

         $('img[id^=bx-gallery-icon-]').on('click', function () {

                 var zoomid = this.id.replace('bx-gallery-icon-', '#bx-gallery-img-');

             });

         $(zoomid).addimagezoom({
                 zoomrange: [1, 10]
             });
     });
</script>

我试图在第二个功能上使用 var 'zoomid',但我不知道如何使用它,点击...

4

1 回答 1

0

尝试这个:

var zoomid;
$(document).ready(function () {
   $('img[id^=bx-gallery-icon-]').on('click', function () {
      zoomid = this.id.replace('bx-gallery-icon-', '#bx-gallery-img-'); 
   }); 
   $(zoomid).addimagezoom({ zoomrange: [1, 10] });
});
于 2013-05-28T17:11:19.323 回答