SWFObject: Full sreen flash with browser scrollbar


/ Published in: JavaScript
Save to your folder(s)

If you are trying to solving one or both of these problems:
+ If the window is resized to a smaller size that was designed for - a scrollbar would be nice.
+ If the content is larger than the original design - a scrollbar would be nice

Then use this code!


Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. //<![CDATA[
  3.  
  4. var size = getViewportSize();
  5. function getViewportSize()
  6. {
  7. var size = [0, 0];
  8. if (typeof window.innerWidth != "undefined") {
  9. size = [window.innerWidth, window.innerHeight];
  10. }
  11. else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0) {
  12. size = [document.documentElement.clientWidth, document.documentElement.clientHeight];
  13. }
  14. else {
  15. size = [document.getElementsByTagName("body")[0].clientWidth, document.getElementsByTagName("body")[0].clientHeight];
  16. }
  17. return size;
  18. }
  19. function createFullBrowserFlash()
  20. {
  21. swfobject.createCSS("html", "height:100%;");
  22. swfobject.createCSS("body", "height:100%;");
  23. swfobject.createCSS("#container", "margin:0; width:100%; height:100%; min-width:980px; min-height:553px;");
  24. }
  25. function setHeight( h )
  26. {
  27. if ( h < size[1] ) h = "100%";
  28. var el = document.getElementById("container");
  29. if ( h != "100%" ) el.style.height = h < 553 ? "553px" : h + "px";
  30. else el.style.height = "100%";
  31. }
  32.  
  33. var flashvars = { };
  34. var params = { "allowscriptaccess": "samedomain" };
  35.  
  36. swfobject.embedSWF("main.swf", "content", "100%", "100%", "9.0.0", false, flashvars, params);
  37. if (swfobject.hasFlashPlayerVersion("9.0.0")) {
  38. swfobject.addDomLoadEvent( createFullBrowserFlash );
  39. }
  40. //]]>
  41. </script>

URL: http://blog.wezside.co.za/2008/10/fullscreen-flas.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.