How to time the effect of a css look in javafx?
Tags: css,javafx
Problem :
Is it possible to give timing for the effects described in CSS?
So what I would like to have is, that if you push a button, then the change in its look lasts a bit longer, even a bit after the release.
So I would imagine some kind of command in the .button:pressed{}
section, that makes this possible.
Or if its only possible in the java code, that's good too! Do you have an idea? Thanks!
So for example:
.button:hover:pressed {
-fx-background-color: #A6C3F1;
-fx-background-radius: 30;
-fx-text-fill: black;
//pseudo: -fx-pressed-lasts: 300 (milisec);
So if you klick on the button, while you are holding the click, the button is gonna have this color. I would like to have this color 300 milisec long even after releasing the mouseclick. And then it would change back to .button:hover{ - whatever -}
Solution :
Imo it is not possible within css. In Java code you can use
@Override
public void start( Stage primaryStage )
{
final Button btn = new Button( "Say 'Hello World'" );
final PauseTransition pt = new PauseTransition( Duration.millis( 3000 ) );
pt.setOnFinished( ( ActionEvent event ) ->
{
btn.getStyleClass().remove( "my-button-pressed" );
} );
btn.setOnMousePressed( ( MouseEvent event ) ->
{
if ( pt.getStatus() != Animation.Status.RUNNING )
{
btn.getStyleClass().add( "my-button-pressed" );
pt.play();
}
} );
StackPane root = new StackPane();
root.getChildren().add( btn );
Scene scene = new Scene( root, 300, 250 );
scene.getStylesheets().add( this.getClass().getResource( "style.css" ).toExternalForm() );
primaryStage.setScene( scene );
primaryStage.show();
}
with style.css like
.my-button-pressed {
-fx-font: 16px "Serif";
-fx-padding: 10;
-fx-background-color: #CCFF99;
}
CSS Howto..
nth-child magic. Probably won't work in older versions of IE. li:nth-child(3n+3) { margin-right: 0px; } http://cssdesk.com/p4VTX...
Hopefully this makes sense. What was happening is the overlay would cover everything, but the overlay is still within body so it worked with body being set. Instead just make...
Here, is the updated fiddle. https://jsfiddle.net/vaydrvcr/1/ You were correct, just you missed that a is always the first child of li. You were to target anchor of first li....
Is this what you wanted? body{ margin:0; } .box1{ background:url('http://lorempixel.com/1000/400') no-repeat; background-size: 100% 100%; position:relative; height:200px; z-index:2; overflow:visible; } .box1:before,.box1:after{ content:" "; background: transparent; position: absolute; width: 15px; height: 15px;...
Change <button id="submit" class="retrievedoc" type="submit" >Submit</button> to <button id="submit" class="retrievedoc" type="button" >Submit</button> If the type is submit the form will automatically submit and will cancel out the dialog....
Why do you use display: table, if you need non-table behaviour? Default table behaviour (if table height is specified) is to expand row heights until whole table height is filled....
Add padding and margin 0 to body body { height:100%; width:100%; background : url('4163-16y6220.png'); padding:0; margin:0; } http://jsfiddle.net/gen7wpkm/1/...
Read up on how css z-index works to determine which layers are on top of which. Higher the z-index, higher the priority
In your CSS Code I changed the position element to absolute, that allows you to place the element exactly where you want: .subMenuCont { position: absolute; top:0; left: 17.5%; width:...
element.style in Firebug is the style applied to the element, for exemple <span style="padding: 10px;">My text</span> element.style will have element.style { padding: 10px; } to override, the best way is...
I would recommend using flexbox. It's a pretty new concept in css, but it has good support in all modern browsers. I personally use it in production. The markup would...
top and left correspond to the top-left corner of your box. What you're trying to do is have them correspond to the center. So if you set margin-top and margin-left...
Here is the Answer CSS #outer { width:100%; text-align: center; } .inner { display: inline-block; } HTML <div id="outer"> <div class="inner"><button type="submit" class="msgBtn" onClick="return false;" >Save</button></div> <div class="inner"><button type="submit" class="msgBtn2"...
Looks like VS does not understand site relative paths, as described in this article. So, to answer your question, either change the CSS URLs to be fully qualified, or live...
You can set "display" property of "#in-logos td div" to "table-cell" and "a" will be vertically centered. display: table-cell is not supported ie7 and below. #in-logos td{ width: 10%; }...
Here's what I managed to do: from scrapy.selector import Selector sel = Selector(text = html_string) for node in sel.css('a *::text'): print node.extract() Assuming that html_string is a variable holding the...
You need to change the existing JS code to this one. $('h1').click(function(event) { $('footer').toggleClass('border'); }); It will show and hide the border when you click the link. Also do not...
Since you already use JavaScript on the page, I would suggest you calculate and assign z-index on document ready, using this tiny jQuery plugin: $.fn.reverseZIndex = function () { //...
First of all, display: visible; !important is invalid. There is no visible value of property display. Also, !important declarations are written before the semicolon, not after. If you are trying...
Although it doesn't make sense why you wouldn't just set #h's width to 100, you can try this: #a{ background-color: grey; padding:5px; display: table; } #b{ width: 100px !important; background-color:...
The first step is to group all related parts together. See the HTML below. Note that title tags were replaced with heading tags. The title should be in the header...
You need to set the position property of the class="row" div to relative and then set the position property of the div containing text to absolute and the bottom property...
inner- display: inline; max-width: _%; max-height: 100%; outer- white-space: nowrap; and position set learn how from http://www.alistapart.com/articles/conflictingabsolutepositions ...
So a good solution here that would make your life a little less stressful would be to set up a css class that has those settings and use easing for...
If you're scaling, you need to ensure you're using the same kind of measurements, in this case percentages. Then, absolutely position your chalkboard on top of the graphic, then tell...
Try adding the following css: li { list-style-type: none; } If that works, then your css selector .product_list is just incorrect and you'll need to specify it in a way...
That one's quite simple. Put the image in a container, and give it an after. Give that after a absolute position and a border. See the example: .gallery { height:...
You can remove float:left; from .wrapper and add margin-left: 20px- it will make .wrapper flexible: .clearfix:before, .clearfix:after { content: ""; display: table; } .clearfix:after { clear: both; } .row {...
Simply change your CSS to care about what the class is... Change li:hover{ background-color: #111; } to .active:hover{ background-color: #111; } ...
Ok, just realized z-index only works with positioned elements. In the case presented, I needed to set the height of the container of the div .overlay (just put height:100% in...