how to make active button in foundation zurb - zurb-foundation

I have tried the following code to create an active button in F5, but its NOT giving active class effect, please let me know why?
<ul class="button-group radius small">
<li class="active">Button 1</li>
<li>Button 2</li>
<li>Button 3</li>
<li>Button 4</li>
</ul>

Zurb foundation does not have any active classes for button groups. You can see here http://foundation.zurb.com/docs/components/button_groups.html
If you want add an active class create one class add to your active buttons,
.activebutton{
background-color: #970b0e;
}

Elaborating on #chinmayahd's answer, for the convenience of anyone looking:
button.active, .button.active { background-color: /*primary active color*/ }
button.secondary.active, .button.secondary.active { background-color: /*secondary active color*/ }
button.success.active, .button.success.active { background-color: /*success active color*/ }
button.alert.active, .button.alert.active { background-color: /*alert active color*/ }
button.warning.active, .button.warning.active { background-color: /*warning active color*/ }
button.info.active, .button.info.active { background-color: /*info active color*/ }
Add your respective active colors, and you're good to go! (I recommend grabbing the hover/focus colors from your foundation.css file.)

Related

Dashboard desktop lay-out responsive?

Building icCube dashboards for different devices is handled via lay-outs. This works nice. But when it comes to desktop dashboards, there is a wide range of screen-sizes and resolutions and you can make only one desktop lay-out.
For example, I've a 15" laptop for on the read that is connected to a 27" monitor on my workbench if I'm in the office. On my monitor I've far more space to have more widgets then on my laptop screen. It would be nice to create separate lay-out for different screen-sizes / screen-resolutions or make a responsive dashboard.
I'm curious if there is a solutions to handle different screen-sizes / screen-resolutions.
We have not yet found a responsive layout that resolved our questions. We are open to ideas, but it's not simple to have a same dashboard that 'works' on both a 10'' and 27'' monitor.
For now you have a few options in icCube :
Create a fixed layout (it's one of the options we prefer)
Create a layout that scales with the size of the screen
Create a report with multiple layouts (this is for tablets, phones, printing). Not yet for different screen sizes.
And indeed you might create a set of different reports.
_hope it helps.
Simple dashboard grid layout
<div class="grid-container">
<header class="header"></header>
<aside class="sidenav"></aside>
<main class="main"></main>
<footer class="footer"></footer>
</div>
Need to apply CSS
/* Simple dashboard grid CSS */
/* Assign grid instructions to our parent grid container */
.grid-container {
display: grid;
grid-template-columns: 240px 1fr;
grid-template-rows: 50px 1fr 50px;
grid-template-areas:
"sidenav header"
"sidenav main"
"sidenav footer";
height: 100vh;
}
/* Give every child element its grid name */
.header {
grid-area: header;
background-color: #648ca6;
}
.sidenav {
grid-area: sidenav;
background-color: #394263;
}
.main {
grid-area: main;
background-color: #8fd4d9;
}
.footer {
grid-area: footer;
background-color: #648ca6;
}
Create the styles and structure for our header and footer elements; grid-area declared previously
<style>
.header, .footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
background-color: #648ca6;
}
</style>
<header class="header">
<div class="header__search">Search...</div>
<div class="header__avatar">Your face</div>
</header>
<footer class="footer">
<div class="footer__copyright">© 2019</div>
<div class="footer__signature">Sample</div>
</footer>

Angular2 unit testing - why nativeElement has empty CSSStyleDeclaration

I'm trying to test a simple header component that has a button and when being focused - opens a dropdown using just css visibility property.
This is the html:
<nav class="navigation">
<button type="button">
<span>click here</span>
</button>
<ul>
<li> Text </li>
<li> Text </li>
<li> Text </li>
</ul>
</nav>
This is the scss style:
button {
span {
margin-right: 10px;
}
&:focus {
+ ul {
visibility: visible;
}
}
}
ul {
position: absolute;
list-style: none;
z-index: 1000;
visibility: hidden;
transition: visibility 0.1s linear;
background-color: $color-primary;
}
And this is the test:
it('should open dropdown on focus', () => {
let button = fixture.debugElement.query(By.css('button'));
button.triggerEventHandler('focus', null);
fixture.detectChanges();
let dropdownElement = fixture.debugElement.query(By.css('ul')).nativeElement;
console.log(dropdownElement);
console.log(dropdownElement.style);
expect(dropdownElement.style['visibility']).toBe('visible');
});
When I run the test I can see that console.log(dropdownElement) exists and that console.log(button.nativeElement) returns the CSSStyleDeclaration object - but ALL the properties have an empty string as a value:
CSSStyleDeclaration {
alignContent: ""
alignSelf: ""
...
...
...
color: ""
visibility: ""
...
...
}
So basically what I need is to trigger the focus event on the button and then see if the value of the dropdown's css/style property "visibility" is "visible".
I can't figure what's wrong, cause i can see that everything is rendering fine in Karma-Debug but all the style properties are empty... any idea what's the problem?
I've had similar problem in runtime (not tests).
Style property is static and based on initial style attribute on html element so this is not updated dynamically.
Solution is to use Window.getComputedStyle(). This function calculates (current!) styles from stylesheets.

How to create custom full screen modal in Ionic2

I want to create custom Full screen Loader component in Ionic2. But my modal div do not cover the header/navbar area. I want it to be like Ionic LoadingComponent covering everything in my app and also have my template variable. Please have a look at image.
My modal css is
#modal{
width: 100%;
height:100%;
position: absolute;
z-index: 100;
background: red;
top: 0px;
left: 0;
}
Please help.
EDIT
My ModalPage has navbar
<ion-header>
<ion-navbar primary>
<button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
<ion-title>Hello Ionic</ion-title>
</ion-navbar>
</ion-header>
EDIT
I found a workaround for this. I just use Ionic2 Popover, Popover gives 100% width+height, full screen. I called the modal popover on button click and dismiss it on 100% download.
You don't need that style rule to make the modal be fullscreen. Please take a look at this plunker.
Like you can se there, the HomePage contains a navbar, but the ModalPage html code is just
<ion-content></ion-content>
With that, and just changing the background-color
ion-page.modal-page ion-content {
background-color: red;
}
The modal should be fullscreen, without showing a navbar.

ember bind-attr class is not being set by controller

I'm creating a master-detail table.
Before an item has been chosen, the details should not be visible, only becoming visible on clicking of an item.
The reason I'm using a class is because the table is normally 100% width, and it changes size when the detail pops up. This is not implemented yet. Right now, I just want the 'with-details' class to be inserted into the div when I click in the < li >
Here is a rough twiddle:
https://ember-twiddle.com/f35bb4b593394d955460a83a10f092a4
In my template, the < li > has an action:
<li {{action 'showDetails'}}>
which fires the showDetails action in my controller (I know it's firing because of the :) in console):
withDetails: false,
actions: {
showDetails: function() {
console.log(":)");
this.set('withDetails', true);
}
}
which should add the with-detail class to my details div:
<div {{bind-attr class=":game-details withDetails"}} >
which should match my CSS:
.game-details {
display: none;
border: 1px solid red;
}
.game-details.with-details {
display: block;
border: 1px solid green;
}
It should be that easy. What am I missing?
[ EDIT ] I just learned this trick:
Wrong:
<div class="game-details" {{bind-attr class="withDetails"}}>
Right:
<div {{bind-attr class=":game-details withDetails"}}>
which shows the div, but does not attach a with-details class I can target.
bind-attr is deprecated since 1.13 and disabled since 2.0. Instead, you should use embedded {{if}} in your class attribute, like so:
<div class="game-details {{if withDetails "with-details"}}">
{{outlet}}
</div>

orbit slideshow custom next prev buttons links left right arrows

I am using zurb foundation orbit slideshow. The next and the prev buttons or links on the left and right edge of the page is the default black triangle. Please have a look at this test page:
http://www.endsnore.com/_test1b/index.aspx
How do I customize the next and prev buttons or links? How do I add my own arrow code: ‹ and › OR add my own custom arrow images
like these orange left and right arrows here:
http://www.getaveo.com/index.aspx
Please provide exact code example. I would appreciate it. Thank you very much in advance!
Working with orbit I found a pretty nice solution: using the :before on the .orbit-prev span and .orbit-next span tag via CSS you can modify the navigation buttons.
I do not think you can add images as button without editing the js code of the slider, but this solution works nicely, and you can obviously tweak it for your needs
See the jsFiddle here: http://jsfiddle.net/endorama/5SHz5/3/
Basically you need to add this CSS, which remove the arrows ( are borders on the span element ) and replace them with a gliph ( see the content: "..." )
.orbit-container .orbit-prev span,
.orbit-container .orbit-next span {
color: red;
border: none;
font-size: 70px;
text-indent: 0;
margin-top: -32px;
}
.orbit-container .orbit-prev {
background-color: transparent;
}
.orbit-container .orbit-prev span:before {
content: "\2039";
}
.orbit-container .orbit-next {
background-color: transparent;
}
.orbit-container .orbit-next span:before {
content: "\203A";
}
Hope this helps, cheers :)
NOTE: Be aware that if stack_on_small is true you content will be stacked and the arrows hidden. I didn't tweak this behaviour because seems logical to me. just disable this option when you initialize Orbit to solve this problem.
My Dear friends! Please find complete solution for your troubles of ORBIT.
It takes 5 min to make custom buttons(image or chevron or font-"Font Awesome") as you navigation arrows.
In your js:
$(".next-slide").click(function() {
$("#ORBIT-ID").siblings(".orbit-next").click();
$("#ORBIT-ID").siblings(".orbit-timer").click(); // Remove this line to pause the orbit. (it pauses whenever you change slides by default)
});
$(".prev-slide").click(function() {
$("#ORBIT-ID").siblings(".orbit-prev").click();
$("#ORBIT-ID").siblings(".orbit-timer").click(); // Remove this line to pause the orbit. (it pauses whenever you change slides by default)
});
In your css:
.orbit-container .orbit-prev, .orbit-container .orbit-next {display: none;}
.next-slide {/* PUT YOUR STyLES HERE*/}
.prev-slide {/* PUT YOUR STyLES HERE*/}
If you are using font awesom:
same js as above
css:
.orbit-container .orbit-prev, .orbit-container .orbit-next {display: none;}
html:
<span class='prev-slide'><i class='icon-chevron-left'></i></span>
<span class='next-slide'><i class='icon-chevron-right'></i></span>
Thats it! Rank me if you like it!
I had success with stacey.mosier's answer and was able to change my arrows to an image using the CSS content property. Using Foundation v5.2.2
Approach #1
This is what working code for a single class looks like:
.orbit-next {
content: url("Homepage/Homepage_Banner_Arrow_Next_on_retina.png");
width: 16px !important;
height: 62px !important;
margin-right: 20px;
}
I set the width and height of the .orbit-next class to be equal to that of the image I'm adding.
And for the hover styling:
.orbit-container .orbit-next:hover {
content: url("Homepage/Homepage_Banner_Arrow_Next_off_retina.png";
background-color: transparent; //so there's no background effect
For .orbit-previous the rules are basically the same as above (except margin-right becomes margin-left and you use the prev arrow path instead of the next)
Approach #2
To stay DRY I instead implemented a "multiple selector" and now only need one arrow asset by rotating the current one via css transform
.orbit-next, orbit-prev { //All the above rules except the margin }
.orbit-next { margin-right: 20px; }
.orbit-prev { margin-left: 20px; transform:rotate(180deg); }
.orbit-container .orbit-next:hover, .orbit-container .orbit-prev:hover {
//the above hover rules
}
I anticipate the need to scale/hide the size of the arrows based on the column width currently active, something to consider, but beyond the scope of this question. Hope this helped!
Obrit comes with default classes. You can customize the classes:
<ul data-orbit data-options="next_class: my_next_class; prev_class: my_prev_class;">
...
</ul>
The default classes .next_class and .prev_class have a text-indent that is pushing the text out of the window.
If you are wanting to replace the content, use the css content: rule.
I think this is a little more straightforward:
For Foundation 5 - this is your jQuery:
$( "a.orbit-prev > span " ).replaceWith( "<img src='images/left_arrow.png' width='68' height='78' />" );
$( "a.orbit-next > span" ).replaceWith( "<img src='images/right_arrow.png' width='68' height='78' />" );
Replace the image URL with the URL of your own image, and the height/width of your own image height/width. To use a font icon, I would do something like this:
$( "a.orbit-prev > span " ).replaceWith( "<span><i class='icon-chevron-left'></i></span>" );
$( "a.orbit-next > span" ).replaceWith( "<span><i class='icon-chevron-right'></i></span>" );
You'll need to overwrite the default css styles too to use images:
.orbit-container .orbit-prev, .orbit-container .orbit-next {
text-indent: 0px !important;
line-height: 78px;
height: 78px;
width: 68px;
}
Keep the text indent at 0, and use your own heights/widths. For an icon font, I didn't try it but I think you should be able to use the existing CSS with no problem.
You'll probably want to remove the hover state as well, but maybe not:
.orbit-container .orbit-prev:hover, .orbit-container .orbit-next:hover {
background-color: transparent; }