I want to create mobile like on/off button with extjs in my web application. I couldn't find any sample or solution for this. I want actually like this: Demo
CSS
/*
Created by #JohnieHjelm. I took the liberty of doing this ON/OFF switch
just to express my love for CSS3. You're free to use this and of course
I hoped you learned something. Sharing is Caring♥
*/
body{
background:#eee;
}
ul{
list-style:none;
width:85px;
height:26px;
position:absolute;
top:50%;
left:50%;
margin:-13px 0 0 -42px;
}
ul li{
float:left;
line-height:23px;
font-size:11px;
padding:2px 10px 0;
background: #E5E5E5;
background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#F3F3F3), to(#E5E5E5));
text-shadow:0 1px 0 #FFF;
border-left:1px solid #D5D5D5;
border-top:1px solid #D5D5D5;
border-bottom:1px solid #D5D5D5;
-webkit-box-shadow:0 1px 0 #FFF inset, 0 0 5px rgba(0, 0, 0, .1) inset, 0 1px 1px rgba(0, 0, 0, .3);
}
ul li:first-child{
-webkit-border-radius:5px 0 0 5px;
}
ul li:last-child{
-webkit-border-radius:0 5px 5px 0;
}
ul li a{
text-decoration: none;
font-family:Helvetica, Arial;
text-transform:uppercase;
color:#a1a1a1;
}
.on{
background: #505050;
background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#777), to(#505050));
text-shadow:0 -1px 0 #444, 0 0 7px #9AE658;
border-right:1px solid #444;
border-top:1px solid #444;
border-bottom:1px solid #444;
-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, .7) inset, 0 1px 0 #FFF;
}
ul li:not(.on):active{
background-image:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#ddd), to(#f1f1f1));
}
ul li.on a{
color:#7BBA47;
cursor: default;
}
jQuery
$(function(){
$("ul li").click(function(){
$("ul li").removeClass("on");
$(this).addClass("on");
});
});
How can I do this with ExtJS?
Just a quick one which can easily extended to a full component:
Ext.get(Ext.query("ul li")).on('click', function(e, t, eOpts) {
var el = Ext.get(this),p;
el.addCls("on");
if((p = el.next())) {
p.removeCls("on");
alert('can fire turn OFF');
} else if ((p = el.prev())){
p.removeCls("on");
alert('can fire turn ON');
}
});
Here's a JSFiddle
Related
In my case I wanted to increase the gap between text and the underline (it is hearder). So I used border-bottom property to do that.But in here I want to use text-shadow, and same shadow for the underline (which in my case is bottom border). how can I do that.
html
<h1 class="headerone">stackoverflow</h1>
css
h1.headerone{
border-bottom:2px solid black;
text-shadow:0 0 5px black;
/* text-decoration:underline; I didn't use this because gap is low */
}
find fiddle demo
h1.headerone{
text-shadow:0 0 5px black;
/* text-decoration:underline; I didn't use this because gap is low */
position:relative;
}
h1.headerone:before{
content:'';
position:absolute;
bottom:-2px;
left:0;
width:100%;
height:2px;
background:#000;
box-shadow:0 0 5px black;
}
Try this css it may help you.
h1.headerone{
border-bottom:2px solid black;
text-shadow:0 0 5px black;
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;
/* text-decoration:underline; I didn't use this because gap is low */
}
Fiddle Demo
in css :
h1.headerone{
border-bottom:2px solid black;
text-shadow:0 0 5px black;
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;
}
<h1 class="shadow">stackoverflow</h1>
CSS Fiddle Demo
h1.shadow {
text-shadow:0 0 5px black;
max-width: 200px;
}
h1.shadow::after {
margin-top: 20px; /* distance goes here */
display: block;
content: ' ';
height: 2px;
background: black;
box-shadow: 0 0 5px black;
}
I've created a Smart App Banner for Android using jquery.smartbanner. I've managed to make it work, but the problem is that the banner (which has a width of 100%) doesn't scale with the screen. So when the user opens the page it's zoomed in (because the website is not responsive) and when he zooms out, the banner (which previously had a width of 100%) now maintains the same width, so it only covers a small percentage of the page. Is there a way to fix this? The official CSS code is provided below.
Many thanks!
#smartbanner { position:absolute; left:0; top:-82px; border-bottom:1px solid #e8e8e8; width:100%; height:78px; font-family:'Helvetica Neue',sans-serif; background:-webkit-linear-gradient(top, #f4f4f4 0%,#cdcdcd 100%); background-image: -ms-linear-gradient(top, #F4F4F4 0%, #CDCDCD 100%); background-image: -moz-linear-gradient(top, #F4F4F4 0%, #CDCDCD 100%); box-shadow:0 1px 2px rgba(0,0,0,0.5); z-index:9998; -webkit-font-smoothing:antialiased; overflow:hidden; -webkit-text-size-adjust:none; }
#smartbanner, html.sb-animation {-webkit-transition: all .3s ease;}
#smartbanner .sb-container { margin: 0 auto; }
#smartbanner .sb-close { position:absolute; left:5px; top:5px; display:block; border:2px solid #fff; width:14px; height:14px; font-family:'ArialRoundedMTBold',Arial; font-size:15px; line-height:15px; text-align:center; color:#fff; background:#070707; text-decoration:none; text-shadow:none; border-radius:14px; box-shadow:0 2px 3px rgba(0,0,0,0.4); -webkit-font-smoothing:subpixel-antialiased; }
#smartbanner .sb-close:active { font-size:13px; color:#aaa; }
#smartbanner .sb-icon { position:absolute; left:30px; top:10px; display:block; width:57px; height:57px; background:rgba(0,0,0,0.6); background-size:cover; border-radius:10px; box-shadow:0 1px 3px rgba(0,0,0,0.3); }
#smartbanner.no-icon .sb-icon { display:none; }
#smartbanner .sb-info { position:absolute; left:98px; top:18px; width:44%; font-size:11px; line-height:1.2em; font-weight:bold; color:#6a6a6a; text-shadow:0 1px 0 rgba(255,255,255,0.8); }
#smartbanner #smartbanner.no-icon .sb-info { left:34px; }
#smartbanner .sb-info strong { display:block; font-size:13px; color:#4d4d4d; line-height: 18px; }
#smartbanner .sb-info > span { display:block; }
#smartbanner .sb-info em { font-style:normal; text-transform:uppercase; }
#smartbanner .sb-button { position:absolute; right:20px; top:24px; border:1px solid #bfbfbf; padding: 0 10px; min-width: 10%; height:24px; font-size:14px; line-height:24px; text-align:center; font-weight:bold; color:#6a6a6a; background:-webkit-linear-gradient(top, #efefef 0%,#dcdcdc 100%); text-transform:uppercase; text-decoration:none; text-shadow:0 1px 0 rgba(255,255,255,0.8); border-radius:3px; box-shadow:0 1px 0 rgba(255,255,255,0.6),0 1px 0 rgba(255,255,255,0.7) inset; }
#smartbanner .sb-button:active, #smartbanner .sb-button:hover { background:-webkit-linear-gradient(top, #dcdcdc 0%,#efefef 100%); }
#smartbanner .sb-icon.gloss:after { content:''; position:absolute; left:0; top:-1px; border-top:1px solid rgba(255,255,255,0.8); width:100%; height:50%; background:-webkit-linear-gradient(top, rgba(255,255,255,0.7) 0%,rgba(255,255,255,0.2) 100%); border-radius:10px 10px 12px 12px; }
#smartbanner.android { border-color:#212228; background: #3d3d3d url('dark_background_stripes.gif'); border-top: 5px solid #88B131; box-shadow: none; }
#smartbanner.android .sb-close { border:0; width:17px; height:17px; line-height:17px; color:#b1b1b3; background:#1c1e21; text-shadow:0 1px 1px #000; box-shadow:0 1px 2px rgba(0,0,0,0.8) inset,0 1px 1px rgba(255,255,255,0.3); }
#smartbanner.android .sb-close:active { color:#eee; }
#smartbanner.android .sb-info { color:#ccc; text-shadow:0 1px 2px #000; }
#smartbanner.android .sb-info strong { color:#fff; }
#smartbanner.android .sb-button { min-width: 12%; border:1px solid #DDDCDC; padding:1px; color:#d1d1d1; background: none; border-radius: 0; box-shadow: none; min-height:28px}
#smartbanner.android .sb-button span { text-align: center; display: block; padding: 0 10px; background-color: #42B6C9; background-image: -webkit-gradient(linear,0 0,0 100%,from(#42B6C9),to(#39A9BB)); background-image: -moz-linear-gradient(top,#42B6C9,#39A9BB); text-transform:none; text-shadow:none; box-shadow:none; }
#smartbanner.android .sb-button:active, #smartbanner.android .sb-button:hover { background: none; }
#smartbanner.android .sb-button:active span, #smartbanner.android .sb-button:hover span { background:#2AC7E1; }
#smartbanner.windows .sb-icon { border-radius: 0px; }
Managed to solve it myself! Set #smartbanner to position:fixed; and you're done :-)
I have a dropdown list menu with small triangle pointer, when I hover the first item I want the small triangle also change to black color.
This is my JS Fiddle, Thanks.
CSS
.username .messages {
position:absolute;
margin:22px 0px 0px -70px;
width:200px;
max-height:auto;
color:black;
-webkit-box-shadow: 0 8px 6px -6px black;
-moz-box-shadow: 0 8px 6px -6px black;
box-shadow: 0 8px 6px -6px black;
}
.username .messages:before {
content:'.';
display:block;
position:absolute;
margin-left:-10px;
left:50%;
top:-18px;
width:0;
height:0;
border:10px solid black;
color:black;
border-color:transparent transparent #fff;
}
Place the arrow as the before pseudoelement of the first link
Example fiddle: http://jsfiddle.net/ebcho06a/5/
.messages a:first-child:before {
content:'';
display:block;
position:absolute;
margin-left:-10px;
left:50%;
top:-20px;
width:0;
height:0;
border:10px solid black;
color:black;
border-color:transparent transparent #fff;
}
.messages a:first-child:hover:before {
border-color:transparent transparent #000;
}
Effect on mouseover
I would classify myself as a beginner and discover answers through trial and error. However I can't solve this. I would like an image to be behind the h2 text on my homepage. I have tried placing it everywhere within here and nothing makes it show up.
Here is my site: http://bitsybride.com
Here is what I want: http://bitsybride.com/Image8.png
Here is the relevant css:
.smallpost {
overflow:hidden;
width:730px;
padding-bottom:0;}
ul.smallpost li {
width:290px;
height:130px;
margin:0 40px 60px 0;
padding:0px 0px 0px 0px;
position:relative;
float:left;
background: url(images/pink ribbon.png);}
ul.smallpost h2 {
font-size: 12pt;
line-height: 0pt;
margin: 0 0 0px 0;
padding:5px 0px 100px 15px;
letter-spacing: -1px;}
ul.smallpost li img {
margin:-20px 0 15px -20px;
width:280px;
height:150px;
overflow:hidden;
padding: 4px;
margin: 1px 1px 4px 1px;
overflow: hidden;
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); /*-moz-border-radius: 5px;-khtml- border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;*/
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
-o-linear-gradient(#2F2727, #1a82f7);
background:
-moz-linear-gradient(center top , #FFFFFF, #EFEFEF) repeat scroll 0 0 transparent
;
background: -webkit-gradient(linear, left top, left bottom,
from(#fff),
color-stop(0.5, #fff),
to(#EFEFEF)
);
filter: progid: DXImageTransform.Microsoft.Gradient(StartColorStr='#ffffffff', EndColorStr='#EFEFEFEF');
-ms-filter: \"progid: DXImageTransform.Microsoft.gradient(startColorstr=#ffffffff, endColorstr=#EFEFEFEF)";
-o-linear-gradient(top, #dcdcdc, #c6c6c6);
border: 1px solid #FFFFFF;
z-index: 5;}
Help!
If you want your h2's to have a background image, try this in your ul.smallpost h2
background-image: url('/wp-content/uploads/2012/05/bitsy2.png');
or wherever your image is.
use display:inline-block in your h2 tag
ul.smallpost li {
width:290px;
height:130px;
margin:0 40px 60px 0;
padding:0px 0px 0px 0px;
position:relative;
float:left;
}
ul.smallpost h2 {
font-size: 12pt;
line-height: 0pt;
margin: 0 0 0px 0;
padding:5px 0px 100px 15px;
letter-spacing: -1px;
background: url(images/pink ribbon.png);
display:inline-block;
}
When browsing the pages of my display cart list and pictures with IE 8 , cannot show pictures ( .jpeg) and shadow effect. but other browser wroks fine..
The pictures are thumbnails that obtained from the photo album ,linked by url,
The below is my CSS.
body {
font-family:Helvetica-light;
font-size:14px;
padding:0;
margin:0;}
h1 {
font-weight:normal;
margin:0 0 10px 0;
}
h2, h3, h4, h5, h6 {
font-weight:normal;
}
a {
text-decoration:none;
color:#777;
display:block;
margin:0 0 10px 0;
}
a:hover {
text-decoration:underline;
}
:focus {outline:none;}
label { display:block; margin:0 0 5px 0;}
input {
display:block;
margin:0 0 5px 0;
}
input[type=submit] {
cursor:pointer;
}
table {
width:100%;
box-shadow:0 0 5px #CCC;
-webkit-box-shadow:0 0 5px #CCC;
-moz-box-shadow:0 0 5px #CCC;
-o-box-shadow:0 0 5px #CCC;
behavior: url(ie-css3.htc);
margin:0 0 10px 0;
}
table tr th {
text-align:left;
font-weight:bold;
padding:10px;
background:#F9F9F9;
}
table tr td {
padding:10px;
}
table tr.empty td {
background:#F9F9F9;
}
.clear { clear:both;}
.bold { font-weight:bold;}
#container {
width:960px;
margin:0 auto;
padding:20px;
box-shadow:0 0 10px #CCC;
-webkit-box-shadow:0 0 10px #CCC;
-moz-box-shadow:0 0 10px #CCC;
-o-box-shadow:0 0 10px #CCC;
behavior: url(ie-css3.htc);
}
.notify {
padding:10px;
background:#E9E9E9;
margin:0 0 10px 0;
}
.product {
float:left;
margin:0 10px 0 0;
box-shadow:0 0 10px #CCC;
-webkit-box-shadow:0 0 5px #CCC;
-moz-box-shadow:0 0 5px #CCC;
-o-box-shadow:0 0 5px #CCC;
behavior: url(ie-css3.htc);
}
.url{
behavior: url(ie-css3.htc);
}
.product .info {
float:left;
padding:10px;}
.product h3 {
margin:0 0 5px 0;
background:#F9F9F9;
padding:10px;
}
behavior: url(ie-css3.htc); does not use the same path structure as background-image: url();
This will not look in the directory your CSS lives in, but rather the docroot of your site. Be sure that this file is accessible from http://yourwebsite.com/ie-css3.htc
Also, I would change the order of your box-shadow CSS declarations like follows:
-webkit-box-shadow:0 0 10px #CCC;
-moz-box-shadow:0 0 10px #CCC;
-o-box-shadow:0 0 10px #CCC;
box-shadow:0 0 10px #CCC; /* This was moved to the bottom */
Since CSS "cascades", a browser that supports box-shadow but keeps -webkit-box-shadow around for legacy reasons would use the non-standard -webkit-box-shadow in how your code was laid out. By moving box-shadow to the bottom, we ensure that browsers who support the standard will use it.