Solved

Change properties of a dialog box

Posted on 2016-11-11
1
34 Views
Last Modified: 2016-11-11
$( function() {
    $( "#dialog" ).dialog({
      autoOpen: false,
      show: {
        effect: "blind",
        duration: 1000
      },

    });
 
    $( "#opener" ).on( "click", function() {
      $( "#dialog" ).dialog( "open" );
    });
  } );

Open in new window


htmlcode:
<div id="dialog" title="hello" style= "float:left;">
  <p>HI welcome to the website, more text will be here.</p>
</div>
<button id="opener" style="float:right;width:50px;height:50px;"><i class="fa fa-info" aria-hidden="true"></i></button>

Open in new window


How can I make the dialog box bigger in width and change the default orange color to blue?
0
Comment
Question by:Jasmine Ikhreishi
1 Comment
 
LVL 20

Accepted Solution

by:
Russ Suter earned 500 total points
ID: 41883916
I'm assuming you're using jQuery UI in your above example. It's not completely clear. However, overriding the width and height of the dialog is relatively easy. You just need to inject your own CSS. You'll need to use the !important rule to make it stick.
.ui-dialog
{
  width: 500px !important;
  height: 400px !important;
}

Open in new window

You can alter colors in the same way although jQuery UI offers a number of theme options to handle this more cleanly. Look at http://jqueryui.com/themeroller/ and see if you can create the theme that suits your liking.

Here's a jsfiddle which demonstrates overriding the width and height properties of the dialog control: https://jsfiddle.net/g3hc8p55/
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now