Any kind of javascript you have will most likely conflict with the javascript that is used within the Kentico UI. I never expect any javascript to work 100% while in design mode, I always test in a different browser while logged out to ensure it is working as expected. If you're trying to code around the javascript in the Kentico UI to get your application to work, you'll spend a lot of time I'm guessing to get things working.
I do believe there are a few places you can check to see what ViewMode the site is in: Macros, C# code, cookie. Those might help but don't believe they will resolve the issue.