Auto height fancybox2

I was using fancybox plugin to one of my site. I really love using it until I encounter this problem. Inside fancybox i want to put an accordion to it. The problem is I want the fancybox height to grow and no scrollbar shown when accordion is being collapse.

please click here for my current code

Answers


You need to update the height after the fancy box opens. Updated your code adding afterShow

$(".fancybox").fancybox({
    openEffect : 'elastic',
    openSpeed  : 150,
    closeEffect : 'elastic',
    closeSpeed  : 150,
    autoDimensions: true,
    height: 'auto',
    afterShow: function(){
        $.fancybox.update()
    }
});

Here is the working demo, http://jsfiddle.net/muthkum/wufGk/1/


Use this:

$.fancybox.update();

Demo: http://jsfiddle.net/wufGk/2/


I have added the below code after height:'auto' in the below url http://jsfiddle.net/sunnyjaysabuero90/wufGk/, it works


    $(".fancybox").fancybox({
        openEffect : 'elastic',
        openSpeed  : 150,
        closeEffect : 'elastic',
        closeSpeed  : 150,
        autoDimensions: true,
        height: 'auto',

    beforeShow: function(){
       this.width = $('.fancybox-iframe').contents().find('html').width();
       this.height = $('.fancybox-iframe').contents().find('html').height();
      }
        fitToView: false
    });

    $('.accordionButton').click(function() {
        $('.accordionButton').removeClass('accordionButton-open');
        $('.accordionContent').slideUp('fast');
        if($(this).next().is(':hidden') == true) {
        $(this).addClass('accordionButton-open');
        $(this).next().slideDown('fast');
        }
    });


Need Your Help

How do i get the effect of a UISwitch as the accessory for a UITableViewCell?

objective-c uitableview uiswitch

I have a working UITableView filled with some options for my app, and i want to add UISwitches to them just like the Settings app, how do i do this?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.