the requirement is that the page must be displayed horizontally, but when the page is made, it is vertical, and there is no way
the requirement is that the page must be displayed horizontally, but when the page is made, it is vertical, and there is no way
according to my observation, because other native interfaces (such as input box pop-up keyboard, etc.) are involved, it is not advisable to switch directly to horizontal display, such as using css transform
, and so on.
you can judge whether the current is displayed horizontally or vertically . If the screen is vertical, the user must be displayed on the landscape screen to get the best experience. Let the user choose the horizontal screen. This practice seems to be more common.
(in addition: if it is a webview page, you can directly let ios or android developers force the webview page to be displayed horizontally)
refer to Tencent's activity page
js file
<img src="' + _this.option.pic + '" id="' + _this.option.prefix + '-landscape-pic" style="display:inline-block;" /><span>' + _this.option.txt + '</span></div>';
document.body.appendChild(landscapeDom);
var img_url = _this.pic;
var img = new Image();
img.src = _this.option.pic;
img.onload = function() {
document.getElementById(_this.option.prefix + '-landscape-pic').width = parseInt(img.width / _this.option.picZoom);
document.getElementById(_this.option.prefix + '-landscape-pic').height = parseInt(img.height / _this.option.picZoom)
}
}
createCss();
createDom();
var landNode = document.getElementById(_this.option.prefix + '-landscape');
var optionMode = option.mode ? option.mode : _this.option.mode;
var winW = document.documentElement.clientWidth || window.innerWidth;
var winH = document.documentElement.clientHeight || window.innerHeight;
var initOrientation = winW > winH ? 'landscape' : 'portrait';
var isOrientationReload = initOrientation == optionMode ? false : true;
if (initOrientation != optionMode)
landNode.style.display = 'block';
else
landNode.style.display = 'none';
var updateOrientation = function() {
document.activeElement.blur();
var orientation = window.orientation;
switch (orientation) {
case 90:
case -90:
orientation = 'landscape';
break;
default:
orientation = 'portrait';
}
if (orientation != optionMode)
landNode.style.display = 'block';
else
landNode.style.display = 'none';
}
window.addEventListener('DOMContentLoaded', function() {
window.addEventListener('orientationchange', function() {
if (isOrientationReload) {
location.reload(true);
}
updateOrientation();
}, false);
}, false);
},
_stopScroll: function() {
event.preventDefault();
},
//
disableScroll: function() {
document.body.addEventListener('touchmove', this._stopScroll, {
passive: false
});
},
//
enableScroll: function() {
document.body.removeEventListener('touchmove', this._stopScroll);
},
//
dialogAction: function(option) {
var ths = this;
var opt = {
'rootEle': '-sharppageContainer',
'wrapClass': '.mod-dialog-wrap',
'openClass': '.j-openDialog',
'closeClass': '.j-closeDialog'
};
for (var k in option)
if (option[k] != '')
opt[k] = option[k];
$(opt.rootEle).on('click', opt.openClass, function() {
var dg = $('-sharp' + $(this).data('dialogid'));
dg.show().addClass('show');
if (dg.data('scroll') != 'scroll')
ths.disableScroll();
}).on('click', opt.closeClass, function() {
var dg = $(this).closest(opt.wrapClass);
dg.removeClass('show');
if (dg.data('scroll') != 'scroll')
ths.enableScroll();
});
}
};
$(function() {
GYST.dialogAction({});
});
directly above the picture, how to take this top value ...
the only thing I can think of now is to save the current canvas to an array every time I finish drawing, and then take it out of the array when I undo it ...
the scheduling page clicks the order to enter the order details. When you return to the scheduling page, you will request data rendering again. Now you want to return to the previous page without rendering. cannot be cached using keep-alive, and activa...
use canvas to draw a chart, but how to implement an adaptive browser ...
recently, if you want to make a table, you need to fix the header and display the first two columns, because the table has a large number of columns, and the width of the table is more than 7000 px. then I have to do fixed two-column positioning. Calcul...
jq gets the date and week of the last seven days, for example: ...
< H2 > encounter an image track that needs to be similar to the figure in a project < H2 > what UI should be used for video tracks like this in the front end, and what common libraries are there < H1 > Thank you! < H1 > ...
The framework is an iview,table component that renders the colorpicker component with the render function. However, an error is reported, indicating that the component is not registered. Code on I commented out the render function, and the compon...
suddenly came up with a question: can I use the false of confirm to cancel the switching of option under select? ` < select name= " " id= "sel " > <option selected value="">coder s life< option> <option value=""&g...
can Wechat Xiaocheng tcp link to intranet devices? ...
how to use flv.js to make a live video http-flv vue? ...
We found that sometimes browsers get stuck, especially in the case of a code loop, so we wonder if there is JS code running. at present, we have two ways to judge: 1. Add console.log output everywhere, and then see if the output is continuous 2. Che...
now I need to realize the effect of flipping books in a single-page mobile application based on vue. Can I only play pictures? can I put the introduced components ?...
-- there are new compatible methods. I haven t done mobile for too long. I d like to consult some optimization methods of mobile ....
problem recovery: I used the vant ui library to develop the mobile end. When I used css module in the vue single-text component, I changed the internal class style of vant, which had no effect. But my custom class has changed correctly. (1) when I che...
when the vue page jumps to the page, the scroll bar is always in the middle (only ios will be in the middle), 0 , there are great gods who encounter the same problems, please show us the way ...
In the video.js used for , two video colleagues play on one page, the progress bar can be replayed at 4:32 seconds when you drag the progress bar, and the progress bar of the other video can be dragged normally. I m a little confused. God s advice ...
now you want to dynamically name the variable BMResulteArr_ variable what to do? ...
it looks like this without sliding at first, as shown in figure ,: ask the gods, how do you do this? ...
how to use the front end to implement a multi-touch handle? ...