Javascript 如何通过jquery打开方框中的图像
我想在花式盒子窗口打开图像。。。 我试着这么做…但这不正常 我试过我的代码如下:Javascript 如何通过jquery打开方框中的图像,javascript,php,jquery,html,css,Javascript,Php,Jquery,Html,Css,我想在花式盒子窗口打开图像。。。 我试着这么做…但这不正常 我试过我的代码如下: $('#show_dialog').click(function() { $.fancybox({ type: 'inline', content: '#img_url' }); }); 我这样称呼我的花式盒子窗口: <td class="center" style="border:#f4f4f4 1px solid; padding:10px">&
$('#show_dialog').click(function() {
$.fancybox({
type: 'inline',
content: '#img_url'
});
});
我这样称呼我的花式盒子窗口:
<td class="center" style="border:#f4f4f4 1px solid; padding:10px"><a href="#" id="show_dialog" >Show Image</a></td>
</tr>
这就是我想展示的div:
<div style="display:none;">
<div id="img_url"> <img src="<?php echo $image_with_url?>" />
<div style="background:#f4f4f4; color:#00; padding:10px;">
<p style="float:right; font-weight:bold;">Invoice No. : <?php echo $ordmaster['invoice_number'];?></p>
<p style="float:left; font-weight:bold;">Date : <?php echo getDateFormat($ordmaster['order_received_date'],1);?></p>
</div>
<div>
<?php if($formPage==''){?>
<img src="<?php echo theme_url(); ?>images/print-icon.png" alt="" style="vertical-align:middle; margin-right:5px;" /><a href="javascript:void(0);" onclick="print();" style="color:#1e1e1e; text-decoration:none; font-size:12px; "><span >Print Page</span></a><?php }?></div>
</div>
</div>
" />
发票编号:
日期:
图像/打印图标.png“alt=”“style=”垂直对齐:中间;右边距:5px;”/>
尝试用href替换内容
$('#show_dialog').click(function() {
$.fancybox({
type: 'inline',
href: '#img_url'
});
});
还有另一种方法可以做到这一点
您的标签html将是
<td class="center" style="border:#f4f4f4 1px solid; padding:10px"><a href="#img_url" id="show_dialog" >Show Image</a></td>
</tr>
您是否收到任何控制台错误?
$("a#show_dialog").fancybox({});