Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Anyone implemented/used Mobile Device Screen Orientation plugin?

m_1985
Level 4
Level 4

Hi,

Has anyone successfully implemented screen orientation plugin in Sitecatalyst to capture mobile device orientation?. When we use the below code in the s_code,  in the web page i am seeing some unusual behavior(ie: when we scroll the page to the bottom and then if i click anywhere on the content section, page goes to the top by default). I understand, that's happening because of this line "window.scroll(0,0)". Any help or thoughts?

Plugin Code below:function screenOrientation(){switch(window.orientation){case 0:case 180:return("Portrait");break;case 90:case -90:return("Landscape");}window.scroll(0,0)}

Reference: http://webanalyticsland.com/sitecatalyst-implementation/capture-mobile-device-screen-orientation-in-...

Thanks in Advance.

1 Accepted Solution
m_1985
Correct answer by
Level 4
Level 4

Hi Gigazelle,

Thanks for the reply. It works fine if we remove that line.

View solution in original post

2 Replies
Gigazelle
Employee
Employee

I struggle to see the value of the window.scroll function in context of the plugin. What happens if you remove that line?

m_1985
Correct answer by
Level 4
Level 4

Hi Gigazelle,

Thanks for the reply. It works fine if we remove that line.