//This code is withing a larger function, but the error is coming into
play when the 'ppButton' is clicked
// It throws the following error in IE 7 (6 not yet tested):
//
// Error: 'data.items[...].background' is null or not an object
// Code: 0
//

var PP = $('.pomonaPeople');

$.getJSON("/dev/home/pp.json",
            function(data){
            PP.css('background', 'url(' + data.items[0].background +
' )' );

            // create navigation
            var ppButton = $('#pp-nav ul li a');
            ppButton.qtip({ style: { name: 'pomonastandard', 'font-
size': '70%', tip: true }, position: { adjust: { mouse: true, x:0, y:
0, screen: true }, corner: { target: 'topRight', tooltip:
'bottomLeft'}} });
            var currentPP = PP.find('#pp-0');

            ppButton.click( function(event) {
              event.preventDefault();
              var ppDivs = PP.children('div');
              var aIndex = $(this).attr('href');
              var destination = PP;
              destination.append('<div class="loading"></div>');
              var aIndexBG = data.items[aIndex].background;
              destination.css('background', 'url(' + aIndexBG +
' )' );
              // set z-index of current div to be above others, and
reset rest
              currentPP.css('z-index', '100');
              currentPP = $('#pp-' + aIndex);
              //console.log(currentPP);
              currentPP.css('z-index', '125');
              destination.find('.loading').fadeOut(FADE);
            });

            PP.find('.loading').fadeOut(FADE);

        });

Reply via email to