I can able to install a lazy load of those images where i haven't given the class, so the lazy load class="lazy" will add to the image to work properly BUT how can i add the lazy load class to that image where i have already given the class name like for example
<img src="img/mobimg.png" alt="mob image" class="mobimg" />
--> Now where to add a lazy load class. I tried adding two classes but it is not working.
I think what you need is Using two CSS classes on one element
the way it would work for you
Related
Maybe a really newbie's question....
I'm starting learning JavaFX in a FMXL Application using the Scene Builder, by reading this tutorials:
http://docs.oracle.com/javase/8/javafx/get-started-tutorial/fxml_tutorial.htm
So once i applied some changes, an issue with this 2 IDs came up... I might have missed or confused something about them...
Can anyone tell me in which cases they are used one or another?
id you use to set a CSS ID to your Component, for example <Text id="welcome-text" .../> and in your stylesheet you have something like #welcome-text { font-size: 16pt; } so this will be applied to your Text.
fx:id you use if you want to work with your Components in your Controller class, where you annotate them with #FXML Text myWelcomeText.
The fx:id is the identity associated to component in fxml to build a controller, and the id is used for css.
I took a look at an FXML document generated using the JavaFX Scene Builder. You access controls from Java Controller with the fx:id. (edit) I stand corrected, the id does matter.
You can apply css from the FXML document like this:
<Slider id="css_id" fx:id="myslider" styleClass="style_name" .../>
(Replace slider with any control)
And Java controller interaction:
#FXML
Slider myslider;
In JavaFX id is used to set a CSS ID to a component. And fx:id is used for accessing that component in code (i.e. in a controller class). fx:id works like a components name.
trying to lazy load one of my custom feature module. it creates chunk but not lazily working in browser. it loads at first time . please suggest what I am missing here...
Based on the fact the chunk is created it looks like you are missing the cmsComponents array.
You need to list the CMS components present in your lazy loaded module, that way Spartacus will know when to load the chunk. Please see https://angular.io/guide/router#getting-route-information and also a quick example I sprung up https://github.com/LTiger14/custom-style-spartacus/blob/main/src/app/app.module.ts#L26-L33.
I want to configure a lazy load of some features with both js and html elements.
If I do aurelia.use.feature('js+html-custom-element') in configure() of main.ts everything works as expected.
But when I postpone loading like
return new FrameworkConfiguration(aurelia)
.feature('js+html-custom-element')
.apply();
then browser loads both js and html files but html is not rendered!? No errors in a console window.
In case with 'js-only-custom-element' lazy load works as expected.
Is this expected behaviour, bug or am I missing something?
aurelia-framework 1.1.5 jspm +type script solution.
Aurelia uses strong file naming convention.
For component, if the file defines class JsHtmlCustomElement, Aurelia expects the file name is js-html-custom-element.js.
For value converter (or binding behaviour, custom attribute), it can
either use naming convention foo-bar.js for class
FooBarValueConverter.
or with help of annotation foo-bar.js for
#valueConverter('fooBar') export class FooBar.
I have an Aurelia application in which I'm trying to build a CMS component. This component will load data from the server and this data mainly contains slug, title and content fields.
I also have several global components defined in my application, and I want to be able to use those components in the server so when I pull that data my CMS component is able to transform/compile those custom elements.
An example would be a tab component. I have the tab component with this structure defined:
<tab-panel>
<tab title="First"></tab>
<tab title="Second"></tab>
</tab-panel>
The CMS component will contain a content property which I use to pass a string like this: '<tab-panel><tab title="First"></tab><tab title="Second"></tab></tab-panel>'
The component needs to compile that string and render it in its view. I've checked the enhance API, but it doesn't worked, at least for me. Any other suggestion to dynamically compile/render custom elements??
Thanks a lot in advance.
I've found the solution. I've used a compose element and InlineViewStrategy and it worked well, the components are shows and binding works as expected.
If your custom elements are registered globally using globalResources you can actually using the TemplatingEngine to dynamically insert content into the DOM and then compile it after-the-fact. This blog post goes into detail in how you can do it.
However, I would use this as a last resort. As is mostly always the case, there are much better ways to do something in Aurelia. Using the <compose> element is a great way to dynamically render content in your Aurelia applications and should always be the first port of call.
I am busy teaching myself FXML.
I'm doing this by following this example.
It's a simple text editor.
However, in the tutorial everything is Java code.
I myself am using FXML to seperate the view of the logic.
I currently face the following challenge:
I have defined an TextArea in my FXML like so:
<TextArea id="taTextArea" fx:id="taContent" wrapText="true" />
Usually you add action listeners using onAction="#actionName"
What I want to know is, how can I do something similar for text changes. So I can detect wether a save is needed, modify the status bar label etc.
I want to avoid having to attach the TextArea to a change listener in the init method of the controller(implementing Initializable).
Also.. when I complete this application, I will write a blog about it.
With the lacking FXML documentation, I think itll be helpfull to other newbies.
So I want my code to be as clean as possible.
EDIT 1
No progress yet. I need to know if theres a thing such as code completion in FXML
So I can check what kind of properties I can use in FXMl. There should be a textLength property. In the provided link the author uses lengthProperty.addListener. I need an FXML equivilant
You could use the onKeyPressed property:
onKeyPressed="#textChanged"
which calls the textChanged method in the specified controller.
For the second question: The best reference for FXML currently is the javadoc of JavaFX, since all properties are listed there.