JQuery Mobile Custom Icon not showing - jquery-mobile

I am trying to add a single custom icon to jqm and I'm doing the following:
<style>
.ui-icon-myicon {
background-image: url('images/myicon.png') !important;
}
</style>
Then in the footer...
<li>
News
</li>
My problem is that nothing is showing up.
I'm I forgetting something here?

WARNING: If you're using jQuery 1.4+, then you need to define these somewhat differently (notice :after below)
.ui-icon-myicon:after {
background-image: url("images/myicon.png");
background-size: 18px 18px;
}
#media only screen and (-webkit-min-device-pixel-ratio: 2) {
.ui-icon-myicon:after {
background-image: url("images/myicon#2x.png");
background-size: 36px 36px;
}
...more HD icon rules go here...
}

Remove your class tag and use the identifiers built into JQM.
News
If you're wanting the icon to appear on a high pixel density device (i.e. an Apple Retina display) you need to include a second image twice the size. So in your CSS:
.ui-icon-myicon {
background-image: url("images/myicon.png");
}
#media only screen and (-webkit-min-device-pixel-ratio: 2) {
.ui-icon-myicon {
/*this image should be sized at 36 x 36 */
background-image: url("images/myicon#2x.png");
background-size: 18px 18px;
}
...more HD icon rules go here...
}

I have faced the same issue, I have checked the inspect element and found that URL of my background custom icon path was wrong.
I have my custom icon in images folder so in CSS I have given
.ui-icon-myicon:after{
background-image:url("images/facebook.png");
/* Make your icon fit */
background-size:18px 18px;
}
The URL pointed previously to:Myproject/css/images/facebbok.png
Then I changed my CSS as:
.ui-icon-myicon:after{
background-image:url("../images/facebook.png");
/* Make your icon fit */
background-size:18px 18px;
}
After doing that I am able to see image

Related

iPhone 6 Plus Doesn't Recognize filter: blur() Css

Okay, so I was styling a blurred header for my company and one of our QA ran into a strange issue. Basically illustrated below.
HTML:
<!-- HTML FILE -->
<div class="bg-item"></div>
CSS:
/* Stylesheet */
.bg-item {
width: 200px;
height: 200px;
display: block;
filter: blur(40px);
background: url('../img/bg.jpg') 0 0 / cover no-repeat;
}
It works on all devices and browsers, except when I set Safari to be in 3x iPhone 6 Plus size (hehe) - then the css style shows that it is invalid...
Verified it on an actual iPhone 6 Plus as well and this holds true? Is it an Apple bug or am I doing something wrong?
Actually it IS a bug on Apple's end, at least it would appear that way considering they didn't openly declare they've dropped support for CSS Filters.
You can use their new backdrop filter to work around this though pretty easily, I've demo'd it below.
HTML:
<!-- HTML FILE -->
<div class="img-wrap">
<div class="bg-overlay"></div>
<div class="bg-item"></div>
</div>
CSS:
/* Stylesheet */
.img-wrap {
width: 200px;
height: 200px;
display: block;
}
.bg-overlay {
width: 100%;
height: 100%;
}
.bg-img {
width: 100%;
height: 100%;
filter: blur(60px);
background: url('../img/bg.jpg') 0 0 / cover no-repeat;
}
//Only show on 3x density devices
#media only screen and (-webkit-min-device-pixel-ratio: 3) {
.ios.bg-overlay {
-webkit-backdrop-filter: blur(60px); //Blurs bg behind it
}
}
In a nutshell, just set up a media query to only use the backdrop on 3x ratio devices on webkit - and as much as I hate to say it android chrome will NOT know what to do with this so you will want to make sure this only gets applied to SAFARI, IOS devices - and it should take care of it.
Hope that helps!

jQuery Mobile icons not showing on Ipad 3

I am using Andy Matthew's custom jQuery Mobile icon pack (both the "original" and "font-awesome" icons . The font-awesome ones work on the iPad, but the "original" icons do not show up (but show up on Samsung devices etc).
I modified the CSS to work with the Rails asset pipeline as follows:
/*
jQuery Mobile Icon Pack
andy matthews
#commadelimited
*/
/* Icons
-----------------------------------------------------------------------------------------------------------*/
.ui-icon,
.ui-icon-searchfield:after {
background: #666666;
background: rgba(0,0,0,.4);
background-image: image-url('vendor/jqm-icon-pack/icons-18-white-pack.png');
background-repeat: no-repeat;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
border-radius: 9px;
}
/* Alt icon color
-----------------------------------------------------------------------------------------------------------*/
.ui-icon-alt {
background: #ffffff;
background: rgba(255,255,255,.3);
background-image: image-url('vendor/jqm-icon-pack/icons-18-black-pack.png');
background-repeat: no-repeat;
}
/* restore default loading image */
.ui-icon-loading {
background: image-url('vendor/jqm-icon-pack/ajax-loader.gif');
background-size: 46px 46px;
}
/* HD/"retina" sprite
-----------------------------------------------------------------------------------------------------------*/
#media only screen and (-webkit-min-device-pixel-ratio: 1.3),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min--moz-device-pixel-ratio: 1.3),
only screen and (min-device-pixel-ratio: 1.3),
only screen and (min-resolution: 1.3dppx) {
.ui-icon-plus, .ui-icon-minus, .ui-icon-delete, .ui-icon-arrow-r,
.ui-icon-arrow-l, .ui-icon-arrow-u, .ui-icon-arrow-d, .ui-icon-check,
.ui-icon-gear, .ui-icon-refresh, .ui-icon-forward, .ui-icon-back,
.ui-icon-grid, .ui-icon-star, .ui-icon-alert, .ui-icon-info, .ui-icon-home, .ui-icon-search, .ui-icon-searchfield:after,
.ui-icon-checkbox-off, .ui-icon-checkbox-on, .ui-icon-radio-off, .ui-icon-radio-on, .ui-icon-email , .ui-icon-page,
.ui-icon-question , .ui-icon-foursquare , .ui-icon-twitter , .ui-icon-facebook , .ui-icon-dollar , .ui-icon-euro,
.ui-icon-pound , .ui-icon-apple , .ui-icon-chat , .ui-icon-trash , .ui-icon-bell , .ui-icon-mappin , .ui-icon-direction,
.ui-icon-heart , .ui-icon-wrench , .ui-icon-play , .ui-icon-pause , .ui-icon-stop , .ui-icon-person , .ui-icon-music,
.ui-icon-rss , .ui-icon-wifi , .ui-icon-phone , .ui-icon-power , .ui-icon-lock , .ui-icon-flag , .ui-icon-calendar,
.ui-icon-lightning , .ui-icon-drink , .ui-icon-android , .ui-icon-edit {
background-image: image-url('vendor/jqm-icon-pack/icons-36-white-pack.png');
-moz-background-size: 774px 54px;
-o-background-size: 774px 54px;
-webkit-background-size: 774px 54px;
background-size: 774px 54px;
}
.ui-icon-alt {
background-image: image-url('vendor/jqm-icon-pack/icons-36-black-pack.png');
}
}
Other than that I have made no changes. The images directory looks like this: assets/images/vendor/jqm-icon-pack
Jquery Mobile serves up Retina optimised icons, but at the time there was a bug in the logic for displaying Retina friendly icons

why does CSS background-size: cover not work in portrait mode on iOS?

I'm trying to set up a manualy splash-image across devices. I'm doing so by checking for orientation (touch devices) or screen width vs. screen height (none touch) and set a url accordingly.
Then I add this CSS rule via Javascript:
document.styleSheets[3].insertRule('.initHandler:before {
background: url('+x+') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}', 0)
With x being the image to be loaded depending on orientation and screen size.
My problem is this works fine in landscape mode, but on my iPad in portrait mode, the correct image is loaded (differ depending on portrait/landscape), BUT it is not expanded to fullscreen size.
Question:
Can I not use CSS background-size on iOS in portrait-mode?
Thanks for help!
EDIT:
Just tried on my Android Smartphone. Works fine there. Makes no sense, why it doesn't work on iPad.
Ok. Here is how it's working (Thanks to #iMeMyself):
body {
background: url(...) no-repeat center center fixed;
-webkit-background-size: 100%;
-moz-background-size: 100%;
-o-background-size: 100%;
background-size: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
So first set it to 100%, then to cover. This way all browser that cannot cover get the 100% value, while the ones that can get the 100% overwritten by cover.
While checking orientation please take note of these points from apple document -
Provide Launch Images :
iPhone-only applications may only have one launch image. It should be in PNG format and measure 320 x 480 pixels. Name your launch image
file Default.png.
iPad-only applications: Create a launch image for each supported orientation in the PNG format. Each launch image must be 1024 x 748
pixels (for landscape) or 768 x 1004 pixels (for portrait).
Universal applications: Include launch images for both iPhone and iPad.
Update Your Info.plist Settings Specify values for the UISupportedInterfaceOrientations and UIInterfaceOrientation
and
Not all browsers recognize the cover keyword for background-size, and as a result, simply ignore it.
So we can overcome that limitation by setting the background-size to 100% width or height, depending on the orientation. We can target the current orientation (as well as the iOS device, using device-width). With these two points I think you can use CSS background-size:cover on iOS in portrait-mode
Here are some other resources I also came across while looking for a solution: Flexible scalable background images, full scalable background images, perfect scalable background images, and this discussion.
According to Designing Websites for iPhone X iOS 11 introduces a new extension for the existing viewport meta tag called viewport-fit, which provides control over the insetting behavior. The default setting is auto, which will not cover the entire screen.
In order to disable the default inset behavior and cause the page to lay out to the full size of the screen, you can set viewport-fit to cover as shown here:
<meta name='viewport' content='initial-scale=1, viewport-fit=cover'>
Without this setting existing techniques used for splash screens and full-size hero images may not display as expected on the iPhone X or other conformant iOS devices.
Code here
It fixing background images for ipad
Just enter sizes according to your image dimentions
/* Page background-image landscape for iPad 3 */
#media only screen
and (min-device-width: 768px)
and (max-device-width: 1024px)
and (orientation: landscape)
and (-webkit-min-device-pixel-ratio: 2) {
.introduction-section {
-webkit-background-size: 2024px 768px !important;
background-size: 2024px 768px !important;
background: url('background-image.jpg') no-repeat center top #000 !important;
}
}
/* Page background-image portrait for iPad 3 */
#media only screen
and (min-device-width: 768px)
and (max-device-width: 1024px)
and (orientation: portrait)
and (-webkit-min-device-pixel-ratio: 2) {
.introduction-section {
-webkit-background-size: 2024px 768px !important;
background-size: 2024px 768px !important;
background: url('background-image.jpg') no-repeat center top #000 !important;
}
}
/* Page background-image landscape for iPad 1/2 */
#media only screen
and (min-device-width: 768px)
and (max-device-width: 1024px)
and (orientation: landscape)
and (-webkit-min-device-pixel-ratio: 1) {
.introduction-section {
background: url('background-image.jpg') no-repeat center top #000 !important;
-webkit-background-size: 2024px 768px !important;
background-size: 2024px 768px !important;
}
}
/* Page background-image portrait for iPad 1/2 */
#media only screen
and (min-device-width: 768px)
and (max-device-width: 1024px)
and (orientation: portrait)
and (-webkit-min-device-pixel-ratio: 1) {
.introduction-section {
background: url('background-image.jpg') no-repeat center top #000 !important;
-webkit-background-size: 5024px 2024px !important;
background-size: 5024px 2024px !important;
}
}
As far as I'm aware, this method works on all IOS devices. Depending on your other page elements (header etc) you may need to adjust z-index for the &:before psuedo-element.
html {
height:100% !important;
}
body {
height:100%;
min-height:100%;
overflow-x:hidden;
overflow-y:auto;
// use your own class here //
&.body-class {
// #screen-xs-max is a Bootstrap3 variable name //
#media screen and (max-width:#screen-xs-max) {
min-height:100vh;
position:relative;
&:before {
position:fixed;
top:0;
left:0;
right:0;
bottom:0;
display:block;
content:"";
z-index:-1;
background-image:url(background-image.jpg);
background-position:center;
background-size:cover;
// Add this unless you compile your LESS using a preprocessor which adds vendor prefixes //
-webkit-background-size:cover;
}
}
}
}

jquery mobile how remove the grey round circle on icon

I build my first phonegap Jquery Appl
Im changing my icon using this class
.ui-icon-myapp-email {
background-image: url("app-icon-email.png");
}
This custom icon is for a list view , and i try to remove the round grey background load
Also my picture is a bit big for the shape
I was playing with the .ui-icon but doesnt work
Cant find the class
I just wanna my custom arrow picture full size on a white background list no round no circle box shape
Maybe there is an attribute or via css to make that
thanks
If you are using jQuery v 1.4.0 + then you just need to add the class .ui-nodisc-icon to your link element to remove that annoying circle. You will not need to edit any css or write any overrides.
Late to the party here, but a simple answer is to add
background-color: transparent;
box-shadow: none;
to your custom class name, so:
.ui-icon-myapp-email {
background-color: transparent;
box-shadow: none;
}
is all you need.
With JQuery Mobile 1.3, now all you have to do is add the class "ui-nodisc-icon", no need to mess around with the CSS.
from JQuery Website:
"If you don’t need the dark circle behind the icons, simply add the ui-nodisc-icon to the element or its container to remove the icon background."
This should work.
.ui-icon-myapp-email {
background:transparent; /* or none */
background-image: url("app-icon-email.png");
/* The following border radius rules will override the circle around your icon */
-moz-border-radius: 0px;
-webkit-border-radius:0px;
border-radius:0px;
}
/* To fix the size issue override the .ui-icon height */
.ui-icon{
width:14px;
height:20px;
}
Overrides the icon disc color to white.
.ui-icon,
.ui-icon-searchfield:after {
background: #fff /*{global-icon-color}*/;
background: rgba(255,255,255,1) /*{global-icon-disc}*/;
background-image: url(images/icons-18-white.png) /*{global-icon-set}*/;
background-repeat: no-repeat;
-moz-border-radius: 9px;
-webkit-border-radius: 9px;
border-radius: 9px;
}
Icon size is specified in ui-icon class which defaults to 18px.
.ui-icon {
width: 19px;
height: 19px;
}
For those of you looking to have just an icon for the button - I found this article to be very useful! I followed the "Reset the button theme" and "Icon-only buttons" sections to get the effect that I needed.
http://appcropolis.com/blog/advanced-customization-jquery-mobile-buttons/
I solved this issue, using:
background-color:transparent;
if you want to add color in background you can use:
background: url(yourimage.png) repeat;

iOS html5 css3 button click style

I write my application on HTML5/CSS3/JavaScript. For my button I create style (all work fine in browser), but when I start my application on iPad my active effect override standart iOS click effect.
How I can override this standart effect?
My style :
<style type="text/css">
.button {
display: inline-block;
width: 150px;
height: 50px;
background: #f78d1d;
background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
background: -moz-linear-gradient(top, #faa51a, #f47a20);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
}
.button:ACTIVE {
background: #f47c20;
background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015) );
background: -moz-linear-gradient(top, #f88e11, #f06015);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015' );
}
My Button:
The answer to your problem I believe is very simple.
Add this following CSS code to your button or body tag (to affect the entire document).
body { -webkit-appearance: none; }
This will remove default styles for buttons that iOS places onto certain UI elements.
Hope that helps.
I had the same problem use the button tag and it seems to override.
<button class="button">Link</button>

Resources