Jump to content

CEF CSS Hover & Page Transparency


Recommended Posts

Hover doesn't work even slowly, transparency is added.


x, y = guiGetScreenSize()
browser = createBrowser(x, y, true, true, false)

addCommandHandler("lgn", function()
  loadBrowserURL(browser, "http://mta/local/login.html")
  addEventHandler("onClientRender", getRootElement(), function()
    dxDrawImage((x/2)-200, (y/2)-100, x, y, browser, 0, 0, 0, tocolor(255, 255, 255), true)


	<script src="client.lua" type="client" />

	<file src="login.html" />
	<file src="user.png" />
	<file src="lock.png" />

	<min_mta_version server="1.5.0-9.07439" />

Login Form HTML


Link to post

Neither does your input or hover work because you've used CreateBrowser which the wiki states as, and highlighted the part which is your problem:


This example shows you how to create a fullscreen web browser (showing a local html file) without input-handling.


You're looking for input-handled functions, which can be done with GuiCreateBrowser. This would do:

local browser = guiCreateBrowser ( ( x / 2 ) - 200, ( y / 2 ) - 100, x, y, true, true, false );
local theBrowser = guiGetBrowser ( browser );
addEventHandler ( "onClientBrowserCreated", theBrowser, 
	function ()
		loadBrowserURL ( source, "http://mta/local/login.html" );


Also, you know that you can position the div with css itself and create the browser with '0, 0, x, y'. right? simply add this to your body element as a class:

top: calc(50% - 100px);
left: calc(50% - 200px);
position: absolute;


  • Like 1
Link to post

guiCreateBrowser should be used for interactive websites, where people can use the website theirself. If you still want to have the dxRender for your browser then simply draw the render over the guiCreateBrowser. the browser will do the functionality while the render does the overlay of it. No idea why you would want that but oh well, you never know!

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...