$(function(){ $('.data-img').click(function(){ var img = this.getAttribute('src'); $('.pic_show img').attr('src',img); $('.pic_looper').fadeIn(500); $('.pic_show').fadeIn(500); }); var obj = document.getElementById("pro_structure_img"); if(obj) { $('.enlarge-btn').click(function(){ var img = obj.getAttribute('src'); console.log(img); $('.pic_show img').attr('src',img); $('.pic_looper').fadeIn(500); $('.pic_show').fadeIn(500); }); } $('.gb').click(function(){ $('.pic_looper').fadeOut(300); $('.pic_show').fadeOut(300); }); $(document).mousedown(function(e){ if (1 == e.which) { var _list = $('.pic_show'); if(!_list.is(e.target) && _list.has(e.target).length === 0){ $('.pic_looper').hide(); $('.pic_show').hide(); } } }); $('.pro-data-img').click(function(){ var img = this.getAttribute('src'); var img2 = new Image(); img2.src = img; var widthn=580; var heightn=0; heightn=580*(img2.height/img2.width); $('.pro-pic_show img').attr('src',img); $('.pro-pic_show img').attr('width',widthn); $('.pro-pic_show img').attr('height',heightn); $('.pro-pic_looper').fadeIn(500); $('.pro-pic_show').fadeIn(500); }); $('.gb').click(function(){ $('.pro-pic_looper').fadeOut(300); $('.pro-pic_show').fadeOut(300); }); $(document).mousedown(function(e){ if (1 == e.which) { var _list = $('.pro-pic_show'); if(!_list.is(e.target) && _list.has(e.target).length === 0){ $('.pro-pic_looper').hide(); $('.pro-pic_show').hide(); } } }); }) document.write("