开发者

nyroModal - how to configure the width and height of the modal box

开发者 https://www.devze.com 2023-02-16 11:50 出处:网络
I am trying to controll the width and height of the modal window, but I have no idea how to override the default settings.

I am trying to controll the width and height of the modal window, but I have no idea how to override the default settings.

I've been looking at the nmObject (http://nyromodal.nyrodev.com/), but my javascript knowledge is not that great and I have no idea what the correct way to implement this is.

Here is my attempt, but with a syntax error:

$.nmObj( sizes: { initW: 300, initH: 300 });

What am I doing wrong? :\

EDIT:

$(function() {
  $('.nyroModal'开发者_运维知识库).nyroModal();
  $.nmObj({sizes: { initW: 300, initH: 300 }});
});

No syntax errors atleast, but I don't think im using the function correctly


try:

$.nmObj({sizes: { initW: 300, initH: 300 }});

Hope it helps.


Looks like you're using nyroModal v2. For an iframe, you need to set the initial size in the CSS:

.nyroModalCont iframe {
    width: 300px;
    height: 300px;
}

There's a github issue for this, which is closed, so I think that's how it will work in this version.

Ivailo's answer applies to nyroModal v1, I believe.


Another way of doing it.

<script type="text/javascript">
  $(document).ready(function() {
    $.nyroModalSettings({
      type: 'iframe',
      height: 500,
      width: 700,
      resizable: true,
      autoSizable: true,
      titleFromIframe: true,
      // modal: true,
      // selIndicator: '#loading',
      contentLoading: "" // use our own
    });

    $('a.nyroModalPhotos').nyroModal();
  });
</script>


For this filter

.* Iframe filter

.* Before: filters.formFile

Locate in min.js the file is part of a string load: function (nm) { nm.store.iframe = $('<iframe />').attr({ src: 'javascript:\'\';', id: 'nyromodal-iframe-' + (new Date().getTime()), frameborder: '0' })

and add

.css({ height: nm.sizes.h })

the result should be

load: function (nm) { nm.store.iframe = $('<iframe />').attr({ src: 'javascript:\'\';', id: 'nyromodal-iframe-' + (new Date().getTime()), frameborder: '0' }).css({ height: nm.sizes.h })
0

精彩评论

暂无评论...
验证码 换一张
取 消