/// <reference path="../Views/Home/tip .cshtml" />//為避免沖突,將我們的方法用一個(gè)匿名方法包裹起來(lái)(function ($) { //擴(kuò)展這個(gè)方法到j(luò)query $.fn.extend({ //插件名字 jManualRead: function (options) { //設(shè)置默認(rèn)值并用逗號(hào)隔開(kāi) var defaults = { readName: "操作說(shuō)明", backgroundColor: "ff6a00", bottom: 0, right: 0, //showPage屬性 pageTitle: "", width: 1200, height: "100%", url: "" } var options = $.extend(defaults, options); return this.each(function () { var o = options; var a = " <div class='readMe'><span>" + o.readName + "</span></div>"; $(this).find(".readMe").remove(); $(this).append(a); if (o.url.length < 1) { return false; } $(this).on("click", ".readMe", function () {//closed='true' if (top.location != location) { //有內(nèi)嵌入的iframe var obj = {}; obj.width = o.width; obj.height = o.height; obj.title = o.pageTitle; obj.src = o.url; obj.method = "windowdialog"; var objToString = JSON.stringify(obj); window.parent.postMessage(objToString, '*'); } else { $("#modalwindow").html(""); var b = PDFObject.embed(o.url, "#modalwindow"); $("#modalwindow").window({ title: o.pageTitle, width: o.width, height: o.height, iconCls: 'fa fa-list' }).window('open'); //$d.find(".modal.onpage-help-modal.in").remove(); //$d.find(".modal-backdrop.in").remove(); //$d.append(c); //var mynode = parent.parent.document.getElementById("read-showPdf"); //var b = PDFObject.embed(o.url, mynode); //$d.on("click", ".modal .btn", function () { // $d.find(".modal.onpage-help-modal.in").remove(); // $d.find(".modal-backdrop.in").remove(); //}); } }); }); } });})(jQuery);
聯(lián)系客服