Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with fancybox2 - $.fancybox.resize is not a function - error

Javascript

/*Corner by Arthur Wulf White
jquery,  jquery ui and jeditable required
*/
$(document).ready(function()
{
    $("a.magicInput").click(function(e){
        e.preventDefault();
        $("ol.addItems").append('<li>Something</li>');
        $.fancybox.resize();
    });
    $("a.fancy").fancybox(       
    {
        'scrolling' : 'no',
        'autoScale' : true,
        'autoDimensions' : true

    });
    return false;
});

Html

<!DOCTYPE html>
<html>
    <head>
        <meta charset=utf-8 />
        <title>
            studyWise - Log in
        </title>
        <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.20.custom.min.js"></script>
    <script type="text/javascript" src="js/fancy/jquery.fancybox.js"></script>
    <script type="text/javascript" src="js/fancy.js"></script>

        <link rel="stylesheet" type="text/css" media="screen" href="css/reset.css" />
        <link rel="stylesheet" type="text/css" media="screen" href="css/style.css" />
        <link rel="stylesheet" href="js/fancy/jquery.fancybox.css" type="text/css" media="screen" />    

    </head>
    <body>
        <div id="wrap">
<div id="menu">
    <a class="fancy" href="#fancybox">Open</a>
</div>
<div id="main">
    <div class="secret">
        <div id="fancybox">
            <a class="magicInput" href="">Ok</a>
            <ol class="addItems">

            </ol>
        </div>
    </div>
</div>
</html>

Result:

$.fancybox.resize is not a function
[Break On This Error]   

$.fancybox.resize();

fancy.js (line 9)
$.fancybox.resize is not a function
[Break On This Error]   

$.fancybox.resize();

fancy.js (line 9)
$.fancybox.resize is not a function
[Break On This Error]   

$.fancybox.resize();

fancy.js (line 9)
$.fancybox.resize is not a function
[Break On This Error]   

$.fancybox.resize();

All I want is a working example where the fancybox extends/ stretches to fit the whole list inside it. Thanks - it should only be one or two more lines in jsfiddle, please help cause I have no idea why it is not working.

like image 751
AturSams Avatar asked Dec 26 '22 23:12

AturSams


1 Answers

You are using fancybox v2.x. Options for this version are new and not compatible with previous versions (1.3.x).

$.fancybox.resize() is NOT a valid method for fancybox v2.x, use $.fancybox.update() instead. It is the same case for autoScale and autoDimensions, which are options for v1.3.x

Check http://fancyapps.com/fancybox/#docs for the right set of options for the version you are using.

like image 85
JFK Avatar answered Dec 29 '22 15:12

JFK