Wednesday, April 13, 2016

Open online tiff, pdf, ppt, pps, doc, docx in a viewer (iframe) Scrolling--click & Key actions disabled

Open online tiff, pdf, ppt, pps, doc, docx in a viewer (iframe)--click & Key actions disabled


CSS RGBA Generator: 

<body oncontextmenu="return false;" onkeydown=" return false">
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
    <%--background-color: rgba(255,255,0,0.1);--%>

    <style type="text/css">
       #overlay {
            width: 990px;
            height: 500px;
            z-index: 1;
            background-color: rgba(102, 94, 113, 0.1);
        }

        iframe {
            width: 1000px;
            height: 500px;
        }

        #container {
            position: relative;
        }

        #overlay, iframe {
            position: absolute;
            top: 0;
            left: 0;
        }
     
    </style>


    <div id="container">
        <div id="overlay" >
        </div>


        <a href="https:portal/test/dGo.ppt" class="embed" style="text-align: center; display: block;">RK Maloth</a>
    
           <script type="text/javascript">


            $(document).ready(function () {
                $('a.embed').gdocsViewer({ width: 740, height: 742 });
                $('#embedURL').gdocsViewer();
            });
           
            (function ($) {
                $.fn.gdocsViewer = function (options) {

                    var settings = {
                        width: '1000',
                        height: '500'
                    };

                    if (options) {
                        $.extend(settings, options);
                    }

                    return this.each(function () {
                        var file = $(this).attr('href');
                        var ext = file.substring(file.lastIndexOf('.') + 1);

                        if (/^(tiff|pdf|ppt|pps|doc|docx)$/.test(ext)) {
                            $(this).after(function () {
                                var id = $(this).attr('id');
                                var url1 = "http://docs.google.com/viewer?embedded=true&url=" + encodeURIComponent(file);
                                // alert(url1);
                                var gdvId = (typeof id !== 'undefined' && id !== false) ? id + '-gdocsviewer' : '';
                               
                                return '<div id="' + gdvId + '" class="gdocsviewer"><iframe id="testframe" src="http://docs.google.com/viewer?embedded=true&url=' + encodeURIComponent(file) + '" width="' + settings.width + '" height="' + settings.height + '" style="border: none;margin : 0 auto; display : block;"></iframe></div>';
                            })
                        }
                    });
                };
            })(jQuery);
                                 
       
        </script>

    </div>
</body>


No comments:

Post a Comment