You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to turn off the slider and remove all its css when orientation is 0 (portrait) or when:
window.addEventListener("resize", function() {
if ( (document.documentElement.offsetWidth < document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: portrait)").matches) ) {
I am trying to turn off the slider and remove all its css when orientation is 0 (portrait) or when:
window.addEventListener("resize", function() {
if ( (document.documentElement.offsetWidth < document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: portrait)").matches) ) {
// turn off slider and reset original css
}
Is there a way to do this? I have tried to .removeAttr('style data-style') but I need to return to original css before slider was attached.
here is my hack solution which uses a reload (not-good):
window.onload = function() {
var smLoad = window.sessionStorage.getItem('smLoad'),
bgLoad = window.sessionStorage.getItem('bgLoad'),
if ( (document.documentElement.offsetWidth < document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: portrait)").matches) ) {
console.log('portrait');
slidr.create('panels-container').stop();
window.sessionStorage.setItem('smLoad', 'true');
window.sessionStorage.setItem('bgLoad', 'false');
} else if ( (document.documentElement.offsetWidth > document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: landscape)").matches) ) {
console.log('landscape');
slidr.create('panels-container', {
controls: 'none',
fade: true,
overflow: true,
keyboard: true,
touch: true
}).start();
window.sessionStorage.setItem('bgLoad', 'true');
window.sessionStorage.setItem('smLoad', 'false');
}
window.addEventListener("resize", function() {
if ( (document.documentElement.offsetWidth < document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: portrait)").matches) ) {
smallLoad();
} else if ( (document.documentElement.offsetWidth > document.documentElement.offsetHeight) || (window.matchMedia("screen and (orientation: landscape)").matches) ) {
bigLoad();
}
}, false);
window.addEventListener("orientationchange", function() {
var orientation = (window.orientation != undefined);
console.log('orientationChange ' + orientation);
if (orientation === 0) {
smallLoad();
}
if (orientation === -90 || orientation === 90) {
bigLoad();
}
}, false);
}
The text was updated successfully, but these errors were encountered: