08.06.2016, 10:57
(This post was last modified: 08.06.2016, 22:09 by Erwin van der Zwart.)
Hi Buuudzik,
Give your landscape and portait plans the exact same name and use _V and _H on the end of the name and use this code as custom JavaScript:
That should do the trick (;
Good luck!
BR,
Erwin van der Zwart
Give your landscape and portait plans the exact same name and use _V and _H on the end of the name and use this code as custom JavaScript:
Code:
$(function(){
function OrientationChange(orientation){
var currentplan_name = planStore[currentPlanId].name;
var firstChars = currentplan_name.substr(0, (currentplan_name.length - 2));
var lastChars = currentplan_name.substr(currentplan_name.length - 2);
var newPlanName = 'Not Found'
if (lastChars == '_V' && orientation == '_H'){
var newPlanName = firstChars + '_H'
}
if (lastChars == '_H' && orientation == '_V'){
var newPlanName = firstChars + '_V'
}
if (newPlanName != 'Not Found'){
for (var key in planStore) {
// skip loop if the property is from prototype
if (!planStore.hasOwnProperty(key)) continue;
var obj = planStore[key];
for (var prop in obj) {
// skip loop if the property is from prototype
if(!obj.hasOwnProperty(prop)) continue;
//console.log(prop + " = " + obj[prop]);
if (obj.name == newPlanName){
showPlan(obj.id);
}
}
}
}
}
function doOnOrientationChange(){
switch(window.orientation)
{
case -90:
case 90:
OrientationChange('_H')
break;
default:
OrientationChange('_V')
break;
}
}
window.addEventListener('orientationchange', doOnOrientationChange);
// Initial execution if needed
doOnOrientationChange();
});
That should do the trick (;
Good luck!
BR,
Erwin van der Zwart