Responsive Design in IPhone and hidden slider in landscape device [closed] - iphone

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm using Bootstrap framework in my website
My website is no't Responsive in IPhone and Ipad device
And I'm create slider using JQuery
I want to show slider in mobile device, hidden in landscape desktop

You need to use Media Queries with your bootstrap to make it more responsive for mobile devices, tablets, desktop etc. Your website will be responsive for landscape desktop, IPhone, IPad etc. You can also create slider for mobile devices and for desktop, Just put display to none.
/* Medium Devices, Desktops */
#media only screen and (max-width : 992px) {
.slider {
display:none;
}
}
Here are other media queries that you can use for almost every device.
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
#media only screen and (min-width : 320px) {
}
/* Extra Small Devices, Phones */
#media only screen and (min-width : 480px) {
}
/* Small Devices, Tablets */
#media only screen and (min-width : 768px) {
}
/* Medium Devices, Desktops */
#media only screen and (min-width : 992px) {
}
/* Large Devices, Wide Screens */
#media only screen and (min-width : 1200px) {
}
/*========== Non-Mobile First Method ==========*/
/* Large Devices, Wide Screens */
#media only screen and (max-width : 1200px) {
}
/* Medium Devices, Desktops */
#media only screen and (max-width : 992px) {
}
/* Small Devices, Tablets */
#media only screen and (max-width : 768px) {
}
/* Extra Small Devices, Phones */
#media only screen and (max-width : 480px) {
}
/* Custom, iPhone Retina */
#media only screen and (max-width : 320px) {
}

Related

UnityEngine screen size fit every Android device

How can I make my game screen fit every Android device. The problem every answer I find is for 2d. I want for 3d games.
You need two things for a 3D game
1-) Optimizing the canvas : https://www.youtube.com/watch?v=95q79j0lNYA
2-) Optimizing the camera angle (if you want it)
Optimizing the camera for every screen resolution may not be as easy as canvas.
For this, you can take certain standard resolutions with (Get in start Script).
Let's set the filed of view of the camera accordingly at Scene Start.
public class CameraOptimize : MonoBehaviour
{
// ========
private void Start
{
CameraOptimizer();
}
private void CameraOptimizer
{
if (Screen.height == 2560 || Screen.width == 1440)
{
Camera.main.fieldOfView = 65.0f;
}
else if (Screen.height == 1920 || Screen.width == 1080)
{
Camera.main.fieldOfView = 75.0f;
}
}
}

Ionic 2 platform height and width inconsistency with orientation changes

I am trying to get the screen height and width of the platform object, but evidently the screen orientation confuses these values.
Test code:
platform.ready().then(() => {
console.log("orientation", screenOrientation.type);
console.log("platform height", this.platform.height());
console.log("platform width", this.platform.width());
events.subscribe('orientation-changed', (screenOrientation) => {
console.log("orientation", screenOrientation.type);
console.log("platform height", this.platform.height());
console.log("platform width", this.platform.width());
});
});
I run the app starting in portrait mode, and I get:
orientation portrait-primary
platform height 567
platform width 360
I rotate the phone to landscape, and I get:
orientation landscape-primary
platform height 567
platform width 360
Until now, everything seems to be in order.
But now, if I turn the phone back to portrait mode, I get:
orientation portrait-primary
platform height 335
platform width 598
If I turn it again to landscape:
orientation landscape-primary
platform height 567
platform width 360
How can I get the correct height and width, without being concerned about the phone orientation?

Adjusting layout for iPhone 5 resolution

In an HTML project, I'm using css to adjust the content layout for specific screen sizes, e.g.
the iPad landscape;
/*
##########################################################################
##########################################################################
iPad Layout Landscape: 1024px.
Content-Element width: 896px.
Gutters: 24px.
Outer content margins: 64px.
Inherits styles from: Default Layout.
##########################################################################
cols 1 2 3 4 5 6 7 8 9 10
px 68 160 252 344 436 528 620 712 804 896
##########################################################################
##########################################################################
*/
#media only screen and (max-device-width: 1024px) and (orientation:landscape) {
}
and that one works but for iPhone 5 portrait, I'm using;
/*
iPhone 5 portrait view
*/
#media screen and (max-device-width: 640px) and (max-device-height: 1136px) and (orientation:portrait) {
}
which doesn't work, that is it's shown as the iPhone 4 version (
/*
#########################################################################
##########################################################################
Overrides styles for devices with a
device-pixel-ratio of 2+, such as iPhone 4.
#########################################################################
##########################################################################
*/
#media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2) {
}
).
The point is, these work for the devices described but on the iPhone 5, it is shown with the iPhone 4 settings, it needs to be made for the Retina 4-inch properties
Any ideas why and how to make it work?
Try this media query?
iPhone 5 media query
#media screen and (device-aspect-ratio: 40/71) {
/* styles for iPhone 5 goes here */
}
*SO Link iPhone 5 CSS media query
If you want to target more than just iOS devices, it's best to avoid the device media queries. On iOS those queries always reflect the portrait width and height, regardless of orientation. On Android and other operating systems, the device width and height will change based on orientation.
So if you want to use a media query that consistently matches the width and height of the current orientation across all devices, you should use max-width/max-height rather than max-device-width/max-device-height. This max sense for desktop browsers too, since you're more interested in the size of the browser window than you are the size of the user's monitor.
Another thing you should always do when working with media queries on mobile devices is to set the viewport metatag with width=device-width. If you don't do this, the media queries will often reflect a virtual viewport which isn't at all what you would expect.
For more information, I'd recommend reading this article from quirksmode.org.
Try to use this:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
CGSize result = [[UIScreen mainScreen] bounds].size;
CGFloat scale = [UIScreen mainScreen].scale;
result = CGSizeMake(result.width *scale, result.height *scale);
//here you can use height or width if depend for landscape or portrait
if(result.height == 960){
//here wat you need to load
}
}
Hope this help you or illuminate to other ways ;)
Why not break this down into a few different queries?
#media only screen and (max-width : 1024px) {
}
#media only screen and (max-width : 640px) {
}
#media only screen and (max-height : 1136px) {
}
#media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
}
#media (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi){
/* 1.25 dpr */
}
#media (-webkit-min-device-pixel-ratio: 1.3), (min-resolution: 124.8dpi){
/* 1.3 dpr */
}
#media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi){
/* 1.5 dpr */
}

Navigation based on screen orientation (landscape or portrait) in Flash CS6

I'm creating an app that will have a different menu if the phone is held landscape, or portrait.
I figure I have to tell flash to move to a new frame when the phone moves from landscape to portrait or vice versa, but I'm not sure the exact code to after creating the orientation event listener.
There are two ways. Listen for a StageOrientationEvent or listen for Event.RESIZE. I personally prefer to use RESIZE as it is called slightly more often and keeps your interface in sync more.
var landscapeNav:Sprite; // this would be your landscape nav. Obviously does not have to be a Sprite
var portraitNav:Sprite; // same as landscapeNav, but this represents your portrait nav
stage.addEventListener( Event.RESIZE, this.stageResizeHandler );
function stageResizeHandler( e:Event ):void {
if ( stage ) { //just to make sure the stage is loaded in this class so we avoid null refs
if ( stage.stageWidth >= stage.stageHeight ) {
landscapeNav.visible = true;
portraitNav.visible = false;
}
else {
landscapeNav.visible = false;
portraitNav.visible = true;
}
}
}
This could definitely be cleaned up (landscapeNav.visible = stage.stageWidth > stage.stageHeight) but this should give you something to go on. If you want to do an animation as Atriace suggested, you would do a TweenLite/Max call within the conditional in the function instead of setting visible to true/false (after the animation is done, though, you should set visible to false just for the same of optimzation)
You don't need to create a new frame. In fact, it may be more visually appealing to watch the old menu slide off, and the new one to animate in (like with TweenLite).
The documentation on orientation change can be found # Adobe's ActionScript APIs specific to mobile AIR applications: "Screen Orientation", and the API.

Blank screen in game after automatic keypad lock in nokia S40

After the automatic keypad lock, when I unlock it, there appears a blank white screen and after 3-4 seconds, the game field appears. Any ideas, how to avoid this behaviour? I want that the game canvas should be immediately displayed after the unlock.
Update:
Here is my startApp method:
public void startApp() {
start();
}
public void start() {
instance = this;
display = Display.getDisplay(this);
display.setCurrent(myGame);
}