I am building an app using ionic 2 following the documentation. I have implemented a fab button with a fab-list. I am trying to put a descriptive label next to the containing buttons. It seems that there is no way to put a label next to floating buttons with ionic 2 out of the box. I have looked to a couple questions about it on stackoverflow and on github.
It is strange that such a basic feature has not been implemented in ionic 2...
Is there an easy way to put a description label next to a floating button in ionic 2?
Thanks
This Worked For me Magnificently
<ion-fab bottom right>
<button ion-fab ><ion-icon name="add"></ion-icon></button>
<ion-fab-list side="top">
<button ion-fab >
<ion-icon name="logo-facebook"></ion-icon>
<div class="label">Facebook</div>
</button>
<button ion-fab >
<ion-icon name="logo-instagram"></ion-icon>
<div class="label" dir="rtl">Instagram </div>
</button>
<button ion-fab >
<ion-icon name="logo-twitter"></ion-icon>
<div class="label" dir="rtl">Twitter</div>
</button>
<button ion-fab >
<ion-icon name="logo-whatsapp"></ion-icon>
<div class="label" dir="rtl">Whatsapp</div>
</button>
</ion-fab-list>
</ion-fab>
CSS :
.fab {
contain: initial;
}
ion-fab {
ion-fab-list button[ion-fab] {
overflow: visible;
div.label {
position: absolute;
right: 48px;
background: rgba(0,0,0,0.7);
height: 24px;
line-height: 16px;
padding: 5px 8px;
border-radius: 3px;
color: #fff;
box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.14), 0 4px 5px rgba(0, 0, 0, 0.1);
}
}
Into the latest Ionic Framework you could show the labels for the IonFabButton as follows:
This is an Ionic-React example:
1. Paste the following into your corresponding .css file
ion-fab-button[data-desc] {
position: relative;
}
ion-fab-button[data-desc]::after {
position: absolute;
content: attr(data-desc);
z-index: 1;
right: 55px;
bottom: 4px;
background-color: var(--ion-color-light);
padding: 5px;
border-radius: 5px;
color: black;
box-shadow: 0 3px 5px -1px rgba(0,0,0,0.2), 0 6px 10px 0 rgba(0,0,0,0.14), 0 1px 18px 0 rgba(0,0,0,0.12);
}
2. You need to use data-desc attribute of your IonFabButton to set the label
<IonFab vertical="bottom" horizontal="end" slot="fixed">
<IonFabButton>
<IonIcon icon={add} />
</IonFabButton>
<IonFabList side="top">
<IonFabButton routerLink="/documents" data-desc="Upload Document">
<IonIcon icon={folderOpen} color="warning" />
</IonFabButton>
<IonFabButton routerLink="/leave" data-desc="Apply for Leave">
<IonIcon icon={calendarOutline} color="secondary" />
</IonFabButton>
<IonFabButton routerLink="/expenses" data-desc="New Expense">
<IonIcon icon={cardOutline} color="success" />
</IonFabButton>
<IonFabButton routerLink="/timesheet" data-desc="New Timesheet">
<IonIcon icon={timeOutline} color="primary" />
</IonFabButton>
</IonFabList>
</IonFab>
Related
can anyone help me? in below that is my code, in that label focus not working when the phone number input field without required. if am using [required] in css its working when i click the input the label going top but its again returns down to the initial value and the label overlapping the given input
Document
#welcome-form {
flex-direction: column;
position: absolute;
height: 220px;
width: 100%;
background-color: white;
border-top-left-radius: 200px 102px;
bottom: 48px;
}
.welcome-form-item {
position: relative;
border-bottom: 2px solid #adadad;
margin: 20px 0;
width: 80%;
margin-left: 50px;
width: 80%;
}
.welcome-form-item-textbox {
width: 100%;
padding: 0 5px;
height: 40px;
font-size: 16px;
border: none;
background: none;
outline: none;
}
.welcome-form-item label {
position: absolute;
top: 50%;
left: 5px;
transform: translateY(-50%);
font-size: 16px;
pointer-events: none;
transition: .5s;
}
.welcome-form-item span::before {
content: '';
background-color: #303041;
position: absolute;
top: 40px;
left: 0;
width: 0%;
height: 2px;
transition: .5s;
}
.welcome-form-item-textbox:focus\~label,
.welcome-form-item-textbox\[required\]:valid\~label {
top: -5px;
color: #adadad;
}
.welcome-form-item-textbox:focus\~span::before,
.welcome-form-item-textbox\[required\]:valid\~span::before {
width: 100%;
}
#welcome-form-item-button {
color: #ffffff;
vertical-align: bottom;
border: 0;
box-shadow: 0 2px 5px 0 rgb(0 0 0 / 20%), 0 2px 10px 0 rgb(0 0 0 / 10%);
font-weight: bold;
font-size: .75rem;
line-height: 2;
border-radius: 2px 60px;
display: block;
width: 80%;
cursor: pointer;
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
font-size: 19px;
margin-left: 50px;
margin-top: 20px;
text-spacing: .5;
}
#welcome-form-item-button:hover {
background-color: #303041;
box-shadow: 0 4px 10px 0 rgb(0 0 0 / 20%), 0 4px 20px 0 rgb(0 0 0 / 10%);
}
<div class="welcome-form-item">
<input class="welcome-form-item-textbox" type="text" id="name" name="name" required>
<span></span>
<label for="name">Name</label>
</div>
<div class="welcome-form-item">
<input class="welcome-form-item-textbox" type="text" id="phone_number" name="phone_number">
<span></span>
<label for="phone_number">Phone Number</label>
</div>
<div>
<button id="welcome-form-item-button" type="button">Start
Conversation</button>
</div>
</form>
`this is my output`
enter image description here
I am using customized check box icheck in JQ Grid edit and add form but checkbox element is not getting posted to the server even it is checked.
Here is the generated markup for the form:
`<td class="CaptionTD">
Status
</td>
<td class="DataTD">
<div style="position: relative;" id="userGroupBean.isActive_icheck" class="icheckbox_square-green checked">
<input title="" style="position: absolute; opacity: 0;" class="FormElement" role="checkbox" name="userGroupBean.isActive" id="userGroupBean.isActive" offval="0" value="1" checked="" type="checkbox">
<ins style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 0px none; opacity: 0;" class="iCheck-helper"></ins>
</div>
</td>`
So here is what I have:
HTML
<div class="frame-container">
<img src="http://placehold.it/400x600" id="image" alt="test" />
<div class="overlay"></div>
</div>
<button id="button">Add Overlay</button>
CSS
.frame-container{
padding: 15%;
background-color: #333333;
-webkit-box-shadow: 4px 6px 5px -1px rgba(120,120,120,0.75);
-moz-box-shadow: 4px 6px 5px -1px rgba(120,120,120,0.75);
box-shadow: 4px 6px 5px -1px rgba(120,120,120,0.75);
}
#image {
width:100%;
overflow: hidden;
}
.frame-holder{
border: 4em #000000 solid;
}
.overlay{
width:100%;
height:100%;
background-color:fff;
background-image: url('http://placehold.it/400x600&text=woo!');
background-size:cover;
z-index:9999;
display:hidden;
}
JS
<script>
$('#button').click(function(){
$('.overlay').css( "display", 'inline'; );
});
</script>
https://jsfiddle.net/vwvu5ee8/7/
All I want to be able to do is click the button and it add the overlay image over the top of the current image.
I've tried all sorts but have started to run out of ideas. I'm sure there is an easy answer from this position.
Try using display:none and display:block instead of display:hidden. There was also an issue with your z-index stacking.
HTML
<div class="frame-container">
<div class="overlay"></div>
<img src="http://placehold.it/400x600&text=Image" id="image" alt="test" />
</div>
<button id="addOverlay">Add Overlay</button>
CSS
.frame-container{
padding: 15%;
background-color: #333333;
position:relative;
-webkit-box-shadow: 4px 6px 5px -1px rgba(120,120,120,0.75);
-moz-box-shadow: 4px 6px 5px -1px rgba(120,120,120,0.75);
box-shadow: 4px 6px 5px -1px rgba(120,120,120,0.75);
}
#image {
width:100%;
overflow: hidden;
position:relative;
z-index:10;
}
.overlay{
width:70%;
height:70%;
position:absolute;
background-color:fff;
background-image: url('http://placehold.it/400x600&text=Overlay');
background-size:cover;
z-index:100;
display:none;
}
JS
$('#addOverlay').click(function(e){
$('.overlay').css('display','block');
});
Here's the demo. And an alternate version using 2 images instead of a background image.
Fiddle — just open it in Chrome and Firefox, all latest.
There is .button class in my CSS — I use it for all kind of buttons: a.button, button.button, etc.
As you see, there are no difference in Chrome between button.button and any other *.button elements.
As you see in FF — button.button is slightly bigger than any other *.buttons.
How can I made FF to render any buttons properly, like Chrome do?
UPDATE:
This is absolutely not a duplicate of any post on SO.
StackOverflow asks for a code:
.button {
font: normal 100% Arial, sans-serif;
position: relative;
display: inline-block;
text-align: center;
text-decoration: none;
vertical-align: middle;
color: #00f;
background-color: transparent;
border: 1px solid #00f;
border-radius: 3px;
user-select: none;
outline: 0;
cursor: pointer;
white-space: nowrap;
}
.button_medium {
padding: 0 12px;
}
.button__text {
font-weight: 400;
display: inline-block;
line-height: 1;
vertical-align: top;
white-space: nowrap;
}
.button__text_medium {
font-size: 90%;
line-height: 28px;
letter-spacing: -1px;
}
<div style="padding:5em;">
<button class="button button_medium" type="button">
<span class="button__text button__text_medium">Save</span>
</button>
<label class="button button_medium">
<span class="button__text button__text_medium">Save</span>
</label>
<span class="button button_medium">
<span class="button__text button__text_medium">Save</span>
</span>
<a class="button button_medium">
<span class="button__text button__text_medium">Save</span>
</a>
</div>
Have you tried? AFAIK it is really a duplicate. See also: http://css-tricks.com/forums/topic/button-padding-issue/
The following code will fix your issue:
button::-moz-focus-inner {
padding: 0 !important;
border: 0 none !important;
}
I have been experiment with Malsup's awesome jQuery cycle plugin and have hit a bit of a snag. I have been using mixed content in my transition div which has worked out fine. The problem occurs when I use pager within the transition divs. Essentially I would like the pager links to transition along with each div so I included the pager div within each transition div.
$(document).ready(function() {
$('#slider').cycle ({
fx: 'scrollLeft',
timeout: 10000,
speed: 500,
pager: '#pager'
});
});
IMAGE
TEXT
TEXT
TEXT
Try It Now!Terms & Conditions Apply
a
<!-- Content Display 1 -->
<div id="cs_1" class="show_content clearb">
<div class="">IMAGE</div>
<div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
<div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
<div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
<div class="button gradient3" style="height: 57px; width: 180px; margin-top: 20px;">
<div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div>
</div>
<div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;">b</div>
</div>
<!-- Content Display 1 -->
<!-- Content Display 2 -->
<div id="cs_2" class="show_content clearb">
<div class="">IMAGE</div>
<div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
<div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
<div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
<div class="button gradient3" style="height: 57px; width: 180px; margin-top 26px;">
<div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div>
</div>
<div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;"></div>
</div>
<!-- Content Display 2 -->
<!-- Content Display 3 -->
<div id="cs_3" class="show_content clearb">
<div class="">IMAGE</div>
<div class="helv reg all" style="width: 500px; font-size: 20px; padding: 0px 0px 10px 0px; color: #ff3e34;">TEXT</div>
<div class="helv reg all" style="width: 500px; font-size: 25px; padding: 0px 0px 15px 0px;">TEXT</div>
<div class="helv reg all" style="width: 500px; font-size: 18px; padding: 0px 0px 15px 0px;">TEXT</div>
<div class="button gradient3" style="height: 57px; width: 180px; margin-top 18px;">
<div id="tryitnow">Try It Now!</div><div id="terms">Terms & Conditions Apply</div>
</div>
<div id="pager" style="z-index: 200; width: 200px; height: 1px; position: relative; top: -70px; right: 0px; bottom: 0px; left: 310px;"></div>
</div>
<!-- Content Display 3 -->
The pager shows up fine on the first slide and transitions out exactly the way I want it to, it does not appear on the following three transitions although the test letters i put in the first two pager divs do. What is it that I am missing here?
Well after a bit more experimentation the fix was surprisingly simple but also had an odd result. All I did was supply a second parm to the pager call:
$(document).ready(function() {
$('#slider').cycle ({
fx: 'scrollLeft',
timeout: 10000,
speed: 500,
pager: '#pager, #pager2'
});
});
I renamed the pager on my second slide to pager2 and voila! However something odd happened, the slider appeared on the two subsequent panels that I had NOT renamed! When there was only one parm in pager they did not appear despite all having been named #pager. Once I added the second parm #pager2, all of the controls named #pager that had not appeared before now seem to be appearing. Removing the second parm reverts it back to the state where only the first set of controls appeared. Odd, but working so I'm not complaining.