0
모달 창을 만드는 jQuery 플러그인을 개발 중이므로 이제 숨기고 나서 요소 원래 상태로 복원하려고합니다.jQuery 플러그인 개발 요소 원래 상태 보존
누군가 나를 도울 수 있습니까?
감사합니다.
---- 갱신 --- 죄송합니다
,
나는 그것을 보여 어떤 장소에서 요소의 HTML을 저장 한 후 다시 때 숨기기를 저장된 데이터를 배치합니다.
(function ($) { // v2ui_modal
var methods = {
show: function (options) {
var _this = this;
var defaults = {
showOverlay: true,
persistentContent: true
};
var options = $.extend(defaults, options);
if (!_this.attr('id')) {
_this.attr('id', 'v2ui-id_' + Math.random().toString().replace('.', ''));
}
if (options.showOverlay) {
$('<div />', { // overlay
id: 'v2-ui-plugin-modal-overlay-' + this.attr('id'),
css: {
zIndex: ($.topZIndex() + 1),
display: 'none',
position: 'fixed',
width: '100%',
height: '100%',
top: 0,
left: 0
}
}).addClass('v2-ui').addClass('plugin').addClass('overlay').appendTo('body');
};
_this.css({
zIndex: ($.topZIndex() + 2),
position: 'fixed'
});
_this.center();
$('#v2-ui-plugin-modal-overlay-' + _this.attr('id')).fadeIn(function() {
_this.fadeIn();
});
},
hide: function() {
var _this = this;
_this.fadeOut();
$('#v2-ui-plugin-modal-overlay-' + _this.attr('id')).fadeOut(function() {
$('#v2-ui-plugin-modal-overlay-' + _this.attr('id')).remove();
if ((_this.attr('id')).substr(0, 8) == 'v2ui-id_') {
_this.removeAttr('id');
};
});
}
};
jQuery.fn.v2ui_modal = function (methodOrOptions) {
if (methods[methodOrOptions]) {
methods[methodOrOptions].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof methodOrOptions === 'object' || !methodOrOptions) {
methods.show.apply(this, arguments);
};
};
})(jQuery);
너무 모호합니다. 몇 가지 코드를 게시하십시오. 너 뭐 해봤 니? – Utkanos
우리가 지금까지 가지고있는 정보에서, 나는 다음과 같이 갈 것입니다 :'$ (". yourElement"). show();' –
어떻게 정보를 얻을 수 있을까요? –