Solved

Change properties of a dialog box

Posted on 2016-11-11
1
19 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

757 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

18 Experts available now in Live!

Get 1:1 Help Now