⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 birtposition.js

📁 基于eclipse的birt报表!!! 是个web项目!
💻 JS
字号:
/******************************************************************************
 *	Copyright (c) 2004 Actuate Corporation and others.
 *	All rights reserved. This program and the accompanying materials 
 *	are made available under the terms of the Eclipse Public License v1.0
 *	which accompanies this distribution, and is available at
 *		http://www.eclipse.org/legal/epl-v10.html
 *	
 *	Contributors:
 *		Actuate Corporation - Initial implementation.
 *****************************************************************************/
 
/**
 *	BirtPosition.
 *	We could extend Position from Ruby.
 */
var BirtPosition =
{
	viewportHeight: function( )
	{
		if (window.innerHeight!=window.undefined) return window.innerHeight;
		if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
		if (document.body) return document.body.clientHeight; 
		return window.undefined; 
	},
	
	viewportWidth: function( )
	{
		if (window.innerWidth!=window.undefined) return window.innerWidth; 
		if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
		if (document.body) return document.body.clientWidth; 
		return window.undefined; 
	},
	
	center: function( )
	{
      	var element = $( arguments[0] );
      	if ( !element ) return;
      	
		var scTop = parseInt( document.documentElement.scrollTop, 10 );
		var scLeft = parseInt( document.documentElement.scrollLeft, 10 );

		element.style.top = ( scTop + ( ( this.viewportHeight( ) - element.offsetHeight ) / 2 ) ) + "px";
		element.style.left =  ( scLeft + ( ( this.viewportWidth( ) - element.offsetWidth ) / 2 ) ) + "px";
    },

	move: function( element, x, y )
	{
      	if ( !element ) return;
      	
		var scTop = parseInt( document.documentElement.scrollTop, 10 );
		var scLeft = parseInt( document.documentElement.scrollLeft, 10 );

		element.style.top = scTop + y + "px";
		element.style.left = scLeft + x + "px";
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -