FancyBox with dynamic size

1

Hello. I have already looked for several examples of how to call a Pop-up Fancybox by passing the size of the window by parameters in my function.

Ex.

AbrirPopUp(url,w, h)
{
    chamar #Fancybox(url,w,h)
}
<a href="Javascript:AbrirPopUp("janela1.htm",700,500)">Janela 1</a>

<a href="Javascript:AbrirPopUp("janela2.htm",900,400)">Janela 2</a>

<a href="Javascript:AbrirPopUp("janela3.htm",400,100)">Janela 3</a>
    
asked by anonymous 24.12.2014 / 03:09

1 answer

1

In your link the filename should be in single quotation marks, the measurements of the parameters should also be single quotation marks, and should contain the unit of measurement in the example below pixel

<a href="Javascript:AbrirPopUp('janela1.htm',700px,500px)">Janela 1</a>

call fancybox on your function by passing parameters

<script>
    function AbrirPopUp (url, w, h) {
        $(".fast_edit").fancybox({
            href            : url,
            autoSize        : false, 
            fitToView       : false,
            width           : w,
            height          : h
        });
    }
</script>
    
10.02.2015 / 20:07