How can I open multiple dialog boxes in a single page?


How can I open multiple dialog boxes in a single page?



I am trying to open multiple dialog boxes in one page with an iframe inside to resemble a browser window.



I have an example here: http://jsfiddle.net/pxQ8j/770/



The first icon opens up when clicked as I want it to, however the second dialog doesn't and the div contents remain unhidden.



I am also curious how I can remove the double scroll bars that show when the dialog is being resized.



Thank you in advance!!



code:






SS 18'

</div>

<br>
<br>




HATS

</div>






iframe {
width: 100%;
height: 100%;
padding-right :0;
overflow: hidden;
}

.ui-dialog .ui-widget-header {
background: #D3D3D3;
border: 0;
color: black;
font-weight: normal;
font-family: Arial;
font-size: 12px;
margin: 1px 0;
}

.ui-dialog .ui-dialog-content {
overflow: auto;
position: relative;
padding: 0
margin: 0;
align-content: center;
height: auto;
width:auto;
}

.ui .dialog {
left: 0;
outline: 0 none;
padding: 0 !important;
position: absolute;
top: 0;

}


.ui .dialog ::-webkit-scrollbar { display: none; }




$( "#gallery" ).dialog({
autoOpen: false,
width:'700px',
resizeable: 'true',
modal: false,
margin: '0',
padding: '0'
});
$( "#hats" ).dialog({
autoOpen: false,
width:'700px',
resizeable: 'true',
modal: false,
margin: '0',
padding: '0'
});

$( '.icon1' ).click(function() {
$( "#gallery" ).dialog( "open" );
});
$( '.icon2' ).click(function() {
$( "#hats" ).dialog( "open" );
});




2 Answers
2



For value of attributes in HTML you must use " , not


"




HTML attributes syntax is name="value" (HTML Attributes)


name="value"



please change id= “hats” to id="hats"


id= “hats”


id="hats"




$( "#gallery" ).dialog({
autoOpen: false,
width:'700px',
resizeable: 'true',
modal: false,
margin: '0',
padding: '0'
});
$( "#hats" ).dialog({
autoOpen: false,
width:'700px',
resizeable: 'true',
modal: false,
margin: '0',
padding: '0'
});


$( '.icon2' ).click(function() {
$( "#hats" ).dialog( "open" );
});
$( '.icon1' ).click(function() {
$( "#gallery" ).dialog( "open" );
});


iframe {
width: 100%;
height: 100%;
padding-right :0;
overflow: hidden;
}

.ui-dialog .ui-widget-header {
background: #D3D3D3;
border: 0;
color: black;
font-weight: normal;
font-family: Arial;
font-size: 12px;
margin: 1px 0;
}

.ui-dialog .ui-dialog-content {
overflow: auto;
position: relative;
padding: 0
margin: 0;
align-content: center;
height: auto;
width:auto;
}

.ui .dialog {
left: 0;
outline: 0 none;
padding: 0 !important;
position: absolute;
top: 0;

}


.ui .dialog ::-webkit-scrollbar { display: none; }


https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js
https://code.jquery.com/ui/1.12.1/jquery-ui.min.js





SS 18'

</div>

<br>
<br>



HATS

</div>









Thank you so much!! I could not figure out what was wrong... I was typing this in notepad instead of a text editor. However, still trying to solve the scrollbar issue :/
– naomi
Jul 3 at 3:56



change id= “hats” to id= "hats" and change overflow: auto; to overflow: hidden; in .ui-dialog-content


id= “hats”


id= "hats"


overflow: auto;


overflow: hidden;


.ui-dialog-content






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages