Quantcast
Channel: BulletProof Security Forum » All Posts
Viewing all articles
Browse latest Browse all 12532

WordPress 4.1 – jQuery UI Dialog window position not centered

$
0
0

Option:  position

This option specifies the initial position of the dialog box. Can be one of the predefined positions: center (the default), left, right, top, or bottom. Can also be a 2-element array with the left and top values (in pixels) as [left,top], or text positions such as ['right','top']. By default its value is { my: “center”, at: “center”, of: window }.

Previously BPS was using position: "center" jQuery code to center jQuery UI Dialog windows on plugin pages. Not sure when things changed or maybe I was getting away with using flaky code. In any case if anyone else runs into a problem in WordPress 4.1 with jQuery UI Dialog window positioning then here is an example of the correct position Option code.

jQuery(document).ready(function($){				
	var $info1 = $("#bps-modal-content1");     
		$info1.dialog({                            
			dialogClass: "wp-dialog",  
			autoOpen: false,
			show: {
				effect: "blind",
				duration: 500
			},
			hide: {
				effect: "explode",
				duration: 300
			},
			modal: false,
		 	width: 400,
		 	height: 500,			
		 	position: { 
				my: "center", 
				at: "center" 
			},
		 	buttons: {             
				"Close": function() {                 
					$(this).dialog("close");             
				}         
			}
		});
 
	$("#bps-open-modal1").click(function(event) {
		event.preventDefault();
		$info1.dialog("open");
	});

Viewing all articles
Browse latest Browse all 12532

Latest Images

Trending Articles



Latest Images