spot: Where's the error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nakedfool
Forum Newbie
Posts: 1
Joined: Wed Mar 11, 2009 7:41 pm

spot: Where's the error

Post by nakedfool »

Hi everyone,
Nice forums here.

I am trying to figure out why the "x" is appearing on my slide show with IE. Also, the scroll left arrow does something funky.

http://wilsonbarnesgc.com

can someone help?

Code: Select all

var homeArray = [
        {type:1,
        imagePath:'images/home_scroller/010.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/villagegrill_2.jpg'},
        {type:1,
        imagePath:'images/home_scroller/004.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/posados.jpg'},
        {type:1,
        imagePath:'images/home_scroller/015.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/peiwei.jpg'},
        {type:1,
        imagePath:'images/home_scroller/001.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/tjhartfords1.jpg'},
        {type:1,
        imagePath:'images/home_scroller/002.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/shullas.jpg'},
        {type:1,
        imagePath:'images/home_scroller/003.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/rockfish.jpg'},
        {type:1,
        imagePath:'images/home_scroller/005.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/timpano.jpg'},
        {type:1,
        imagePath:'images/home_scroller/006.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/tinstar.jpg'},
        {type:1,
        imagePath:'images/home_scroller/007.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/tjhartfords2.jpg'},
        {type:1,
        imagePath:'images/home_scroller/008.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/uat.jpg'},
        {type:1,
        imagePath:'images/home_scroller/009.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/villagegrill.jpg'},
        {type:1,
        imagePath:'images/home_scroller/011.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/Abuelos_tulsa.jpg'},
        {type:1,
        imagePath:'images/home_scroller/012.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/1011.jpg'},
        {type:1,
        imagePath:'images/home_scroller/013.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/cuba_libre.jpg'},
        {type:1,
        imagePath:'images/home_scroller/016.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/patrizio.jpg'},
        {type:1,
        imagePath:'images/home_scroller/014.jpg',
        imageWidth:'230',
        imageHeight:'140',
        headerPath:'',
        copy:'',
        linkDestination:'/images/high/cool_river.jpg'},
        ];
        
var homeArrayIndex = 0;
var inTransition = false;
    
 
$(function(){
    
    if($('.homeScrollerContainer').length > 0){
        
        var initialBoxSubcontainer = $('<div id="boxSubcontainer' + homeArrayIndex + '" class="boxSubcontainer"></div>').appendTo('#scrollerBoxContainer');
        
        WriteHomeBoxes(initialBoxSubcontainer);
        $('#btnLeft').click(function(){
            if(inTransition)
                return;
            inTransition = true;
            var oldIndex = homeArrayIndex;
            homeArrayIndex -= 3;
            if(homeArrayIndex < 0)
                homeArrayIndex += homeArray.length;
            var newBoxSubcontainer = $('<div id="boxSubcontainer' + homeArrayIndex + '" class="boxSubcontainer"></div>').appendTo('#scrollerBoxContainer');
            newBoxSubcontainer.css('left',-831);
            WriteHomeBoxes(newBoxSubcontainer);
      newBoxSubcontainer.animate({left:"0px"}, 1000);
      $("#boxSubcontainer" + oldIndex).animate({left:831}, 1000, "swing", function(){
        $("#boxSubcontainer" + oldIndex).remove();
                inTransition = false;
      });
        });
        $('#btnRight').click(function(){
            if(inTransition)
                return;
            inTransition = true;
            var oldIndex = homeArrayIndex;
            homeArrayIndex += 3;
            var newBoxSubcontainer = $('<div id="boxSubcontainer' + homeArrayIndex + '" class="boxSubcontainer"></div>').appendTo('#scrollerBoxContainer');
            WriteHomeBoxes(newBoxSubcontainer);
            newBoxSubcontainer.css('left',831);
      newBoxSubcontainer.animate({left:"0px"}, 1000);
      $("#boxSubcontainer" + oldIndex).animate({left:-831}, 1000, "swing", function(){
        $("#boxSubcontainer" + oldIndex).remove();
                inTransition = false;
      });
        });
        
    }
    
    
    var currentNavZIndex = 500;
    var navParents = $('#nav ul li').parents();
    navParents.each(function(){
        $(this).css('z-index',currentNavZIndex);
        currentNavZIndex--;
    });
    
    $('#nav li').mouseover(function(){
        $(this).addClass('liHover');
    });
    $('#nav li').mouseout(function(){
        $(this).removeClass('liHover');
    });
    if(navSelector){
        $('#nav li a.' + navSelector).addClass('active');
        $('#nav li a.' + navSelector + ' ~ ul').addClass('active');
        $('#nav li ul.active a.' + subnavSelector).addClass('active');
    
        $('#nav li a').mouseover(function(){
            $('#nav li ul.active').removeClass('active');
        });
        $('#nav li a').mouseout(function(){
            $('#nav li a.' + navSelector + ' ~ ul').addClass('active');
        });
    }
    if(footerSelector){
        $('#footer a.' + footerSelector).addClass('active');
    }
});
function WriteHomeBoxes(__boxSubcontainer){
    var position = 0;
    for(var i = homeArrayIndex; i < homeArrayIndex + 3; i++, position++){
        var j = i % (homeArray.length);
        switch(homeArray[j].type){
            case 1:
                var link = homeArray[j].linkDestination;
                homeScrollImageContainerTemplate = '<div class="imageContainer" onclick=\'window.open(\"' + link + '\")\'><img /></div>';
                homeScrollCopyContainerTemplate = '<img class="copyHeader" /><a class="copyLink"></a>';
                homeScrollBoxTemplate = '<div class="box">' + homeScrollImageContainerTemplate + homeScrollCopyContainerTemplate + '</div>';
                var newBox = $(homeScrollBoxTemplate).appendTo(__boxSubcontainer);
                newBox.find('div.imageContainer img').attr('src',homeArray[j].imagePath).attr('width', homeArray[j].imageWidth).attr('height', homeArray[j].imageHeight);
                newBox.find('img.copyHeader').attr('src',homeArray[j].headerPath);
                newBox.find('div.copyText').append(homeArray[j].copy);
                //newBox.find('a.copyLink').attr('href',homeArray[j].linkDestination);
                newBox.css('left', (position % 3 * 277) + 'px');
            break;
            case 2:
                var newBox = $(homeScrollBoxTemplate2).appendTo(__boxSubcontainer);
                newBox.find('p.wrapper').append(homeArray[j].content);
                newBox.css('left', (position % 3 * 277) + 'px');
            break;
        }
    }
} 
function PopulateContent(passed){
    $('.contentRight div').css('display','none');
    $('#' + passed).css('display','block');
}
homeScrollCopyContainerTemplate2 = '<p class="wrapper"></p>';
homeScrollBoxTemplate2 = '<div class="box">' + homeScrollCopyContainerTemplate2 + '</div>';
 
function clone(obj){
    if(obj == null || typeof(obj) != 'object')
        return obj;
    var temp = new obj.constructor(); // changed (twice)
    for(var key in obj)
        temp[key] = clone(obj[key]);
   return temp;
}
 
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: spot: Where's the error

Post by jaoudestudios »

Can you take a screen shot of the 'x'. Is it a red x in a square? It means there is an image missing - wonderful IE :?
JeffG
Forum Commoner
Posts: 35
Joined: Wed Jan 30, 2008 1:42 pm
Location: Newbury, UK

Re: spot: Where's the error

Post by JeffG »

Your code is Javascript, not PHP.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: spot: Where's the error

Post by jaoudestudios »

JeffG wrote:Your code is Javascript, not PHP.
That is true :lol:
Post Reply