Also, instead of saying

var imgs0Slideshow = new Array();
imgs0Slideshow[0] = new Object();

It's easier to just say

var imgs0Slideshow = [];
imgs0Slideshow[0] = {};

and that achieves the exact same thing.

On Feb 8, 1:10 am, seasoup <seas...@gmail.com> wrote:
> $("imgDisplay0_title").innerHTML = title;
> $("imgDisplay0_caption").innerHTML = caption;
> $("imgDisplay0_number").innerHTML = "1 of " + imgs0Slideshow.length +
> " Articles";
>
> should be
>
> $("imgDisplay0_title").html(title);
> $("imgDisplay0_caption").html(caption);
> $("imgDisplay0_number").html('1 of ' + imgs0Slideshow.length + '
> Articles');
>
> or
>
> $("imgDisplay0_title").text(title);
> $("imgDisplay0_caption").text(caption);
> $("imgDisplay0_number").text('1 of ' + imgs0Slideshow.length + '
> Articles');
>
> or
>
> $("imgDisplay0_title").get(0).innerHTML = title;
> $("imgDisplay0_caption").get(0).innerHTML = caption;
> $("imgDisplay0_number").get(0).innerHTML = "1 of " +
> imgs0Slideshow.length + " Articles";
>
>  or
>
> $("imgDisplay0_title")[0].innerHTML = title;
> $("imgDisplay0_caption")[0].innerHTML = caption;
> $("imgDisplay0_number")[0].innerHTML = "1 of " + imgs0Slideshow.length
> + " Articles";
>
> .html('text'); is the standard jQuery way to do add html, but is
> slower then .text which is the jQuery way to add plain text, which is
> slower then .innerHTML, but not by significant amounts unless you are
> in a big loop.  .html() also handles removing events from DOM Elements
> that are written over this way which prevents circular references that
> can cause memory leaks.  but, if speed is a big factor and you don't
> have any events doing .get(0) or [0] work.
>
> The problem is that $() returns a jQuery collection not a DOM object
> with the .innerHTML method.  .get(0) or [0] will return the first
> element in the jQuery collection which is the DOM node you are looking
> for with the innerHTML method.
>
> Hope that helps.
>
> Josh Powell
>
> On Feb 7, 10:10 pm, MH1988 <m.lawrencehu...@gmail.com> wrote:
>
> > I hope I am able to still receive assistance even though this isn't
> > jQuery 100% and what I have is an image gallery I am using. The only
> > thing I need to work out is how to make sure the initial title and
> > captions appear when you load the webpage?
>
> > <script type='text/javascript'>
> > var imgs0Slideshow = new Array();
> > var imgs0;
> > imgs0Slideshow[0] = new Object();
> > imgs0Slideshow[0].image = "";
> > imgs0Slideshow[0].title = "";
> > imgs0Slideshow[0].caption = " shshshshshsh";
> > imgs0Slideshow[1] = new Object();
> > imgs0Slideshow[1].image = "";
> > imgs0Slideshow[1].title = "Array";
> > imgs0Slideshow[1].caption = " shshshshs";
> > imgs0Slideshow[2] = new Object();
> > imgs0Slideshow[2].image = "";
> > imgs0Slideshow[2].title = "";
> > imgs0Slideshow[2].caption = " shshshsh";
> > var start = 0;
> > imgs0 = new MudFadeGallery('imgs0', 'imgDisplay0', imgs0Slideshow,
> > {startNum: start, preload: true, autoplay: 4});
>
> > var title = (imgs0Slideshow[0].title) ? imgs0Slideshow[0].title : "No
> > Title";
> >         var caption = (imgs0Slideshow[0].caption) ? imgs0Slideshow
> > [0].caption : "No caption";
> >         $("imgDisplay0_title").innerHTML = title;
> >         $("imgDisplay0_caption").innerHTML = caption;
> >         $("imgDisplay0_number").innerHTML = "1 of " + imgs0Slideshow.length 
> > +
> > " Articles";
> >         $("imgDisplay0").src = imgs0Slideshow[start].image;
>
> > </script>
>
> > The entire Gallery works correctly but I am not sure if the last part
> > of the script is structured correctly. When it is first loaded, the
> > first image does appear but without it's title and captions and I want
> > to show it.

Reply via email to