Need some help with jquery plugin for responsive fullscreen isotope.

Need some help with jquery plugin for responsive fullscreen isotope.

Hi.
I'm using this plugin (see code below) for a responsive fullscreen isotope portfolio gallery:

The problem is that if I use the following at the beginning of the script:

  1. var container = $('.gallery-isotope');

Filtering works, but it won't go fullscreen.

If I use:
  1. var $container = $('.gallery-isotope');

It goes fullscreen, but the filtering doesn't work any more.
Hopefully someone here can point out what the problem is.
Thanks in advance for any help.

Here the full script:
  1. jQuery(document).ready(function () {
  2.     (function ($) {


  3.         var container = $('.gallery-isotope');


  4.         function getNumbColumns() {
  5.             var winWidth = $(window).width(),
  6.                 columnNumb = 1;


  7.             if (winWidth > 1500) {
  8.                 columnNumb = 6;
  9.             } else if (winWidth > 1200) {
  10.                 columnNumb = 5;
  11.             } else if (winWidth > 900) {
  12.                 columnNumb = 4;
  13.             } else if (winWidth > 600) {
  14.                 columnNumb = 3;
  15.             } else if (winWidth > 300) {
  16.                 columnNumb = 2;
  17.             }

  18.             return columnNumb;
  19.         }


  20.         function setColumnWidth() {
  21.             var winWidth = $(window).width(),
  22.                 columnNumb = getNumbColumns(),
  23.                 postWidth = Math.floor(winWidth / columnNumb);

  24.         }

  25.         $('#portfolio-filter #filter a').click(function () {
  26.             var selector = $(this).attr('data-filter');

  27.             $(this).parent().parent().find('a').removeClass('current');
  28.             $(this).addClass('current');

  29.             container.isotope({
  30.                 filter: selector
  31.             });

  32.             setTimeout(function () {
  33.                 reArrangeProjects();
  34.             }, 300);


  35.             return false;
  36.         });

  37.         function reArrangeProjects() {
  38.             setColumnWidth();
  39.             container.isotope('reLayout');
  40.         }


  41.         container.imagesLoaded(function () {
  42.             setColumnWidth();


  43.             container.isotope({
  44.                 itemSelector: '.box',
  45.                 layoutMode: 'masonry',
  46.                 resizable: false
  47.             });
  48.         });




  49.         $(window).on('debouncedresize', function () {
  50.             reArrangeProjects();

  51.         });


  52.     })(jQuery);
  53. });