How do you change the background color of a jquery mobile list view 1.40? - jquery-mobile

I'm having trouble changing the background on a list view in jqm... I can't change it to tranparent. What is the jqm class inheritance structure for this?

I had a lot of problems with this. There are some high level class inheritances to overcome and they are not easily found. Here is an example with jquery mobile 1.40. This is a sample allowing you to create a fully custom listview.
The trickiest ones are the ones that deal with the first-child and the button li.ui-first-child a.ui-btn - it took me a few hours to track this done. Hopefully this helps others as 1.40 is now final.
The following example is a very common necessity creating a custom menu on an overlay panel.
<ul data-role="listview" class="primary-menu">
<li data-icon="false">
<a href="#product" class="ui-btn ui-nodisc-icon ui-btn-icon-left ui-icon-myicon" >
View Products </a>
</li>
</ul>
/* Menu Classes */
.ui-btn-close-panel {
background-color:#b4316c !important;
}
ul.primary-menu {
margin-top:10px;
border-top:none;
}
ul.primary-menu li a{
font-size: 1em;
line-height: 1.3;
color:#ffffff !important;
font-family: 'ramblabold', Arial, sans-serif;
background-color:transparent !important;
border-bottom:1px solid #f2e3ea !important;
background-image:none !important
}
ul.primary-menu.ui-listview li.ui-first-child a.ui-btn {
color:#ffffff !important;
background-color:transparent !important;
border-bottom:1px solid #f2e3ea !important;
background-image:none !important
}
ul.primary-menu.ui-listview li a.ui-btn {
color:#ffffff !important;
background-color:transparent !important;
border-bottom:1px solid #f2e3ea !important;
background-image:none !important
}

Related

With jQuery-Mobile, how to insert icon into table cell

In the example
http://jsfiddle.net/yotam/n2mfy3hg/
there is a table with an anchor alert-button inside a table-cell.
<span>
<a id="aimg" href="#" data-inline="true"
class="ui-btn ui-btn-inline ui-icon-search ui-btn-icon-notext"></a>
</span>
How can one have this 'alert' icon simply inserted in a table-cell,
without neither an anchor nor a button, thus
avoiding the unnecessary <a>-markup and undesired hover effect?
You can use a simple span with a couple of CSS rules to position it correctly for a jQM icon
<span class="ui-icon-alert ui-btn-icon-notext inlineIcon"></span>
.inlineIcon {
display: inline-block;
position: relative;
vertical-align: middle;
margin-right: 6px;
}
If you prefer the icon to be dark without the gray circle behind it:
<span class="ui-alt-icon ui-icon-alert ui-btn-icon-notext inlineIconNoDisk"></span>
.inlineIconNoDisk {
display: inline-block;
position: relative;
vertical-align: middle;
margin-right: 6px;
}
.inlineIconNoDisk:after {
background-color: transparent !important;
}
Here is your updated FIDDLE (both options are shown)

IOS Phonegap : landscape to portrait break overflow-x

I've got an issue and can't solve it easily because appears only in one case : when i'm on my page and i switch from landscape to portrait, on iOS.
My app is a Phonegap app using Angular and plugin device-orientation to make it working with my responsive CSS.
All is fine, except this part.
I've got an horizontal menu and i wan't user able to scroll it if there is overflow.
Here is my code :
CSS
nav.inline {
background: #e4eeef;
outline: 1px solid #e4eeef; /* Safari bug rendering */
overflow: hidden;
overflow-x: scroll;
text-transform: uppercase;
-webkit-overflow-scrolling: touch;
}
nav.inline ul {
list-style: none;
min-width: 102%;
padding: 0 2%;
width: 102%;
white-space: nowrap;
}
nav.inline ul li {
display: inline-block;
white-space: nowrap;
}
nav.inline ul a {
border-bottom: 4px solid transparent;
border-top: 4px solid transparent;
color: #4b8c95;
display: inline-block;
font-size: 1.7em;
font-weight: bold;
line-height: 80px;
margin: 0 0.7em;
}
nav.inline ul a.active {
border-bottom: 4px solid #4b8c95;
}
HTML
<nav class="fullwidth inline" ng-include="'partials/nav.html'"></nav>
And the partial associated
<ul data-snap-ignore="true">
<li><a ng-click="setTab('link1')">Link 1</a></li>
<li><a ng-click="setTab('link2')">Link 2</a></li>
...
</ul>
You can see "data-snap-ignore" because i'm using angular-snap.js for an other menu (left menu) and i don't wan't him to appear when i'm sliding this one (this part is working well).
Thanks for helping ;)
Yep, this sucks. It's a bug, AFAICT.
So far the only mechanism I've found to fix it is to toggle display from none to block on the container, like so:
var navElement = document.getElementsByTagName("nav")[0];
navElement.style.display = "none";
setTimeout ( function() { navElement.style.display = "block"; }, 0 );
Which *looks * horrible, in my opinion, but it does restore the scrolling ability.
Since, as far as I can tell, it never breaks if the elements within force the container to scroll, it should work to ensure that the container always scrolls, even if by a pixel or two.

Links aren't linking

When I click on my links, they do not go anywhere; I clicked on "about Us" , nothing. I looked at Lucas Green's answer to anc1revv, but I'm still drawing a blank. I appreciate any ideas. Also the links do not turn yellow when I hover. I know it's something minor.
Sorry, I meant turn orange when I hover.
Thank you
<body>
<div id="container">
<div id="header">
<img class="logo" src="images/green-light.jpg" alt="Green Light Data Technologies" />
<img class="header-star-left" src="images/arrow2.jpg" alt="All Systems Go" />
<img class="header-star-rt" src="images/arrow2.jpg" alt="All Systems Go" />
<h1>Green Light Data Technologies</h1>
<h2>Keeping All Systems GO!</h2>
</div><!--/#header-->
<div id="nav">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Products</li>
<li>Contact Us</li>
</ul>
</div><!--/#nav-->
<div id="content-home">
<h1>Welcome to Green Light Data Technologies!</h1>
<p>Thank you for visiting our site. Here you will find the latest cabling products, accessories and expert advise on their use. Our employees are well trained, product knowledgeable and are pleased to assist you.
Our website is designed to be easy to navigate and easy to learn more about Green Light product lines that may be of interest to you.
We are committed to supplying excellent electronic components that will meet your needs and to the development of unique future electronic components that will open new vistas in electronics. We actively pursue the improvement of existing products, the strengthening of newly developed products.</p>
</div><!--/#content-->
</div><!--/#container-->
</body>
</html>
/* MAIN NAVIGATION
----------------------------------- */
#nav {
float: left;
width: 900px;
height: 53px;
padding: 0;
margin: 0;
}
#nav ul {
list-style: none;
padding: 0;
margin: 205px;
margin-left: 1em;
}
#nav ul li {
float: left;
line-height: 53px;
padding: 0;
margin: 0 50px 0 0;
}
#nav ul li a {
font-family: arial, helvetica, sans-serif;
font-size: 1.4em;
font-weight: bold;
/*color: #fff;*/
color: #fff;
text-decoration: none;
}
#nav ul li a:hover {
position: relative;
bottom: -5px;
background-color: orange;
border-bottom: 2px dotted #fff;
}
Its probably your browser's popup blocker preventing the _blank link opening a new popup. look at the top (for firefox and chrome) or bottom (for IE) for notifications to allow popup.
orange hover links are working as expected.
check this JSFiddle I added this:
body {
background-color: #999999;
}
so your menu is visible.

How to make one side of a div pointy with CSS?

I'm trying to create a pointy button like this:
So far, I was only able to achieve this:
I thought increasing the horizontal border-radius would make it sharp, but all it does it make the roundness longer.
HTML
<a class="button">Back</a>
CSS
.button {
display: inline-block;
height: 3em;
padding: 0 0.7em 0 1.4em;
border: 0.1em solid black;
border-radius: 3em 0.4em 0.4em 3em / 1.5em 0.4em 0.4em 1.5em;
background: -moz-linear-gradient(
top,
#fff,
#ccc
);
}
You don't want to be using border-radius as that assigns a quarter-circle shape to each specified corner. Instead you hack it with specific border-width properties, as illustrated in this site: http://www.howtocreate.co.uk/tutorials/css/slopes
However I feel you're solving the problem the wrong way; what you're doing is best done using a background image, which is how the iOS-style Back buttons are implemented in iPhone-for-web stylesheets. If you need something resolution-independent then you can use SVG without penalty now.
Having thought about it more, this is a more elegant solution that allows much more effective styling and the use of just one HTML element. Using this method, we can achieve the results in your concept completely.
HTML
Back
CSS
a.button {
text-decoration:none;
color:#111;
text-shadow:0 1px 0 #fff;
font-weight:bold;
padding:10px 10px;
font-size:14px;
border-radius:0 8px 8px 0;
-webkit-border-radius:0 8px 8px 0;
float:left;
margin-left:30px;
margin-top:20px;
position:relative;
font-family:verdana;
color:#3b3d3c;
border:1px solid #666;
border-left:0;
background: -moz-linear-gradient( top , #eee 0%,#bbb 100%);
background: -webkit-linear-gradient( top , #eee 0%,#bbb 100%);
}
a.button:after {
content:"";
width:25px;
height:25px;
background: -moz-linear-gradient( left top , #eee 0%,#bbb 100%);
background: -webkit-linear-gradient( left top , #eee 0%,#bbb 100%);
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
display:block;
position:absolute;
top:5px;
left:-14px;
z-index:-1;
border:1px solid #666;
}
#media screen and (-webkit-min-device-pixel-ratio:0) {
a.button:after{
border-left:0;
left:-13px;
}
The last rule is for Chrome, which otherwise renders the result slightly differently.
Hope this helps.
You can create such an effect using 2 elements side by side wrapped in the anchor tags.
<style type="text/css">
.arrow-left {
width:0;
height:0;
border-top:30px solid transparent;
border-bottom:30px solid transparent;
border-right:30px solid orange;
float:left;
}
.button {
float:left;
height:60px;
background:orange;
width:50px;
line-height:60px;
font-weight:bold;
border-top-right-radius:8px;
border-bottom-right-radius:8px;
}
</style>
</div><div class="button">Back</div>
I'm not sure if it's the most refined solution, but it certainly looks the same as your concept art and functions as intended.

sIFR - getting a:hover to work in navigation list

I am currently struggling with sIFR and a:hover.
My problem site is hosted at http://irene.huditsch.info
I have the following HTML code:
<body id="irene-huditsch-info">
<div id="header">
<h1>Irene Huditsch</h1>
<div id="top-nav">
<ul>
<li id="impressum">
Impressum
</li>
<li id="kontakt">
Kontakt
</li>
</ul>
</div>
...
My sIFR-config.js looks like:
sIFR.replace(braganza, {
selector: 'div#top-nav a',
css: '.sIFR-root { background-color: transparent; color: #FFFFFF; line-height: 13px; font-size: 11px; text-decoration: underline; cursor: pointer; } .sIFR-root:hover { color: #592b02; }',
wmode: 'transparent'
});
But the hover doesn't take effect. I tried different solution with no success either.
When I write
sIFR.replace(braganza, {
selector: 'div#top-nav li',
css: 'a { background-color: transparent; color: #FFFFFF; line-height: 13px; font-size: 11px; text-decoration: underline; cursor: pointer; } a:hover { color: #592b02; }',
wmode: 'transparent'
});
(which seems logical to me), the list items are not rendered at all.
Could you please give me an advice how to do it correctly with the structure given?
Thanks,
Roman
Replacing the a directly will not work, since the Flash movie will only contain the link text and not the link itself.
Your second example should work, assuming you've removed the first attempt, however I see that on the page you're using .sIFR-root a as the CSS selector. That might be confusing Flash a little. Also, the background-color, line-height and cursor properties are not supported for a elements.

Resources