Is there any option to hide iframe border edges in the following js code? !(function (n)…
- User
Is there any option to hide iframe border edges in the following js code? !(function (n) { var i = {}; function r(e) { if (i[e]) return i[e].exports; var t = (i[e] = { i: e, l: !1, exports: {} }); return n[e].call(t.exports, t, t.exports, r), (t.l = !0), t.exports; } (r.m = n), (r.c = i), (r.d = function (e, t, n) { r.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n }); }), (r.r = function (e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }); }), (r.t = function (t, e) { if ((1 & e && (t = r(t)), 8 & e)) return t; if (4 & e && "object" == typeof t && t && t.__esModule) return t; var n = Object.create(null); if ( (r.r(n), Object.defineProperty(n, "default", { enumerable: !0, value: t }), 2 & e && "string" != typeof t) ) for (var i in t) r.d( n, i, function (e) { return t[e]; }.bind(null, i) ); return n; }), (r.n = function (e) { var t = e && e.__esModule ? function () { return e.default; } : function () { return e; }; return r.d(t, "a", t), t; }), (r.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); }), (r.p = "/dist"), r((r.s = 1)); })([ function (e, t) { e.exports = jQuery; }, function (e, t, n) { "use strict"; n.r(t); var i = n(0), r = n.n(i), a = "simple-iframe-view"; function o(e, t) { for (var n = 0; n < t.length; n++) { var i = t[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i); } } var u = { urlSelector: "a", urlAttribute: "href", container: "", template: '', marginHeight: 0, maxCache: 100, autoResize: !0 }, c = (function () { function n(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; !(function (e, t) { if (!(e instanceof t)) throw new TypeError( "Cannot call a class as a function" ); })(this, n), (this.options = r.a.extend({}, u, t)), (this.container = r()(this.options.container)), (this.uid = new Date().getTime() + Math.random()), (this.namespace = "".concat(a, "-").concat(this.uid)), (this.index.on( "click.".concat(this.namespace), this.options.urlSelector, function (e) { var t = r()(e.currentTarget).attr( n.options.urlAttribute ); t && (n.showUrl(t), e.preventDefault()); } ); } }, { key: "unbind", value: function () { this.current && this.hide(this.container .find("iframe") .filter(function (e, t) { return r()(t).attr("src") == n; }); } }, { key: "addIframe", value: function (e) { var t = this, n = r()(this.options.template) .attr("src", e) .on("load", function (e) { t.loaded(r()(e.currentTarget)); }) .on("iframe:resize", function (e) { t.resize(r()(e.currentTarget)); }); return this.current = e).show(), this.index.trigger("iframe:hide", [e]), (this.index.trigger("iframe:loaded", [e]), this.options.autoResize && this.resize(e); } }, { key: "resize", value: function (e) { var t = e[0].contentWindow; if (t) { var n = t.document; if (n && "complete" == n.readyState) { var i = n.body.scrollHeight + this.options.marginHeight; e.height(i), this.$index.trigger( "iframe:resized", [e] ); } } } }, { key: "cache", value: function (n) { var i = this; this.cached.forEach(function (e, t) { e.is(n) && i.cached.splice(t, 1); }), this.cached.push(n), this.options.maxCache < this.cached.length && this.cached.shift().remove(); } } ], [ { key: "getDefaults", value: function () { return u; } }, { key: "setDefaults", value: function (e) { r.a.extend(u, e); } } ] ), n ); })(); (r.a.fn.simpleIframeView = function (i) { return this.each(function (e, t) { var n = r()(t); n.data(a) || n.data(a, new c(n, i)); }); }), (r.a.SimpleIframeView = c); } ]);
- Assistant
To hide the border edges of an
<iframe>, you can set thestyleattribute of the iframe to remove its border. The iframe's border can be set to0ornone. In your code, you should modify thetemplateproperty to include a style that hides the border. Here’s how you could change the relevant part of your code:var u = { urlSelector: "a", urlAttribute: "href", container: "", template: '<iframe scrolling="no" style="border: none;">', // added style="border: none;" marginHeight: 0, maxCache: 100, autoResize: !0 };In this updated code,
style="border: none;"is added to theiframetemplate string. This CSS style will ensure that the iframe has no border when it is rendered on the page.Alternatively, if you have control over the CSS, you can also globally remove the border from all iframes using a CSS rule like this:
iframe { border: none; }This CSS rule would be placed in a stylesheet or a
<style>tag in your HTML page. It will apply to all iframes, so if you only want to target specific iframes, you should use more specific selectors.