B Johnson
B Johnson

Reputation: 193

JQuery - Trying to resize a Fancybox

I'm trying to resize a fancybox lightbox so that it doesn't take up the whole entire page. Here's the code I have so far:

<script type="text/javascript">
    $(.fancybox.open({
        autoDimensions: false,
        width: "60%"
    });​
</script>

But that doesn't do anything. Is there anything wrong with this code specifically?

Upvotes: 1

Views: 44

Answers (1)

Apolymoxic
Apolymoxic

Reputation: 836

You could try something like:

<script type="text/javascript">
    $('.fancybox').css("width", "60%");
</script>

You may need to do this after the box is opened, if the box attributes are created when the box is first opened.

It looks like you are trying to do some function call, but I don't think that's needed. However, if you do need that, try using this:

<script type="text/javascript">
    $('.fancybox').open(function(){
        width: "60%"
    });
</script>

Or, try this based on @Xetnus suggestions.

Upvotes: 1

Related Questions