How to use a fonticon inside a NativeScript <Button> - nativescript

I'm running into a font-family collision when trying to use a icon font on a <Button>.
For example:
<Button class="btn btn-primary fas" text="{{'fa-film' | fonticon}} Test"></Button>
CSS:
.fas {
font-family: 'Font Awesome 5 Free Solid', fa-solid-900;
}
When using the Nativescript themes, it defines the font-family for the .btn class. As you know iconfonts rely on font-family as well.
So in the button above how do apply one font-family to the string Test while applying another font-family to the icon?
If you use the NativeScript Angular SASS starter app and define .fas in _app-common.scss and use my button above, you will see that the icon displays as a ?. This is because .btn is overriding the font-family.
I could solve this by giving the icon font-family a higher precedence - but this would prevent me from styling the textual font on the button.
Non-nativescript implementations of font icons inside buttons solve it by being able to put an element (like <span>) as a child element to <Button>. Example here.
How can you accomplish this with NativeScript <Button>?

The answer is to use FormattedString. It allows you to apply a class to each element.
Ex:
<Button (tap)="onTap($event)" class="btn btn-primary">
<FormattedString>
<Span class="fas" text="{{'fa-film' | fonticon}}"></Span>
<Span text=" Test" fontAttributes="Bold"></Span>
</FormattedString>
</Button>

Related

how to use right to left icons in semantic-ui accordion?

I want to use "semantic-ui" accordion with "rtl" icon in default accordion's icons looks like > and i want my accordions icons looks like this <
please help me to do this.
You can simply change the icon class that you are using to achieve your requirement.
I have used "angle left icon" for rtl. There are many more icon to show rtl, here is the link that contains list of supported icon by default in semantic.
<div class="ui styled accordion">
<div class=" title">
<i class="angle left icon"></i>
Title1
</div>
<div class="content">
<p>Title Content</p>
</div>
</div>
NOTE:
Make sure you are using icons from the correct version. Some of the legacy version icons doesn't work with the latest semantic version.

How can I make a Glyphicon with inverse coloring with React-Bootstrap?

Using React-Bootstrap, how can I make an inverse glyphicon button?
I have buttons like this:
<Button onClick={this.onHome} >
<Glyphicon glyph="home" />
</Button>
but I'd like them to appear reversed.
This question asks about colors which is not the same.
Thanks!
To show a glyph on a green colored background, use bsStyle="success":
<Button onClick={this.onHome} bsStyle="success">
<Glyphicon glyph="home" />
</Button>
Another example, using a label instead of a button:
<Label bsStyle="success"><Glyphicon glyph="home" /></Label>
Some alternatives to success are warning info and for Button also link. The complete list is in the documentation at http://react-bootstrap.github.io/components.html

Material Design Lite buttons on Joomla 3.x

I'm attempting to add the buttons from Material Design Lite (http://www.getmdl.io/) to a Joomla 3.x site.
I followed the directions to the best of my ability and the output I get is not getting the styling.
I attempted to thoroughly document my attempt on this page: http://www.cherokeecollisioncenter.com/sandbox
All help is greatly appreciated.
Here is the correct answer for buttons that take a couple common local business mobile actions:
**<p style="text-align: center;"><button class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored" onclick="location.href='tel:1234567890'"><i class="material-icons">call</i> </button><button class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored" style="margin-left: 10%; margin-right: 10%;" onclick="location.href='//www.google.com/maps/dir//remaining-portion-of-link-to-directions'"><i class="material-icons">directions</i> </button><button class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored" onclick="location.href='mailto:info#example.com'"><i class="material-icons">mail</i> </button>
</p>**
You must also include the two CSS style sheets and the JS script file in the head of each page. In my case the hosted CSS overrode some of my site settings and I had to override them again.
The styling looks pretty much right to me... what exactly are you trying to achieve? Do you have a mockup? Have you cleared your cache?
If you're using these on mobile and you want them to float over the page you're going to have to set the CSS style position property to fixed. You can change the icon by replacing "add" with the name of any icon on the material icons page: https://www.google.com/design/icons/
A floating home button would probably look something like this:
<button class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored" style="position:fixed; right:10px; bottom:10px;"><i class="material-icons">home</i> </button>

Vertically centering content with fullpage.js

According to the fullpages.js documentation, it should be possible to vertically center the contents of .sections with the parameter verticallyCentered (which defaults to true).
However, I can't get this feature to work with the following HTML structure:
<div id="content">
<div class="section container">
<div class="row">
<div class="col-xs-12">
<h1 class="title">Title</h1>
</div>
</div>
</div>
</div>
The content of the .col-xs-12 div (i.e. the heading) remains at the top of the window.
I am using Bootstrap for scaffolding (if that is of any relevance). Also, the basic functionality of fullpage.js (i.e. the single-page scrolling) is working without any problems.
You are probably using some absolute positioned element and that's the reason why fullpage.js can not deal with it.
You can easily see in the examples that fullpage.js centers the content correctly when using verticalCentered:true, which is the default value.
I had the same issue.
I fixed it by styling the default class, added by fullpage.js:
.fp-tableCell {
display: flex;
align-items: center;
justify-content: center;
}
Since I couldn't get the vertical centering functionality to work, I ended up disabling it by setting verticalCentered to false. As a replacement I am now using jQuery-Flex-Vertical-Center which works out of the box.
Sorry to resurrect this question but the problem is that you didn't include the css file of FullPage.js

How to disable an arrow using java script of a carousel

I want to disable this img tag where id is scroll_disable how to achieve this using java script. this image is a arrow key of a carousel of a live shopping website what i want to do is when there is no images for this product i want to disable this arrow.so that user can not scroll further. i need solution in java script only.can i do this onclick() function?
<div id="btn-next" class="f-x3" style="position:relative; float:left; width:30px;height:50px; padding-left:10px; padding-top:20px; overflow:visible">
<p class="f-lp" ><a href="#" class="carousel_carousel next" ><img src="/site/images /arrows1.jpeg" border="0" width="21" height="24" style="vertical-align:baseline" id="scroll_disable" /></a></p>
</div>
how to write java script for this?
Okay, first of all, when you're writing in a language that is not your first, punctuation gets extra-important.
If you don't have to worry about images showing up in the carousel later, try this:
document.getElementById('btn-next').removeEventListener('click');
Check out the following.
http://jsfiddle.net/WRbxe
<img> is not a form element and hence can't be disabled. However if you use <input type="image"> it can be disabled using,
document.getElementById('scroll_disable').disabled=true;

Resources