-1

Hi I need to show a image once its clicked in a different window

following is my html bock

<div data-role="content" class="jqm-content">

<h2>Photo popup example</h2>
<div data-demo-html="true">
    <a href="#popupParis" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" src="images/paris.jpg" alt="Paris, France" style="width:30%"></a>
    <a href="#popupSydney" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" src="images/sydney.jpg" alt="Sydney, Australia" style="width:30%"></a>
    <a href="#popupNYC" data-rel="popup" data-position-to="window" data-transition="fade"><img class="popphoto" src="images/newyork.jpg" alt="New York, USA" style="width:30%"></a>

    <div data-role="popup" id="popupParis" data-overlay-theme="a" data-theme="d" data-corners="false">
        <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a><img class="popphoto" src="images/paris.jpg" style="max-height:512px;" alt="Paris, France">
    </div>
    <div data-role="popup" id="popupSydney" data-overlay-theme="a" data-theme="d" data-corners="false">
        <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a><img class="popphoto" src="images/sydney.jpg" style="max-height:512px;" alt="Sydney, Australia">
    </div>
    <div data-role="popup" id="popupNYC" data-overlay-theme="a" data-theme="d" data-corners="false">
        <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a><img class="popphoto" src="images/newyork.jpg" style="max-height:512px;" alt="New York, USA">
    </div>
</div>

right now it does not open in a different window , SO i need to open it in a different window any help ?

4

1 回答 1

0

工作演示http://jsfiddle.net/cse_tushar/a7r2M/

我将图像包装在标签中 n 通过 jquery 代码将其设置为在新选项卡中打开

$(document).ready(function () {
    $('.popphoto').each(function () {
        this1 = $(this);
        this1.parent()
            .prepend('<a href="' + this1.attr('src') + '" target="_blank"><img src="' + this1.attr('src') + '"class="popphoto" style="' + this1.attr('style') +
            '" alt="' + this1.attr('alt') + '"/ ></a>');
        this1.remove();
    });
});
于 2013-07-22T07:38:40.590 回答