Problem with two dimensional array in JS - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Other (
https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (
https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Problem with two dimensional array in JS (
/showthread.php?tid=345614)
Problem with two dimensional array in JS -
System64 - 25.05.2012
Hi guys, I just developed my Image Viewer jQuery Plugin and I found few bugs, I fixed some of them but I still get one error with two dm array
Problem: can't convert undefined to object
here is the line:
Код:
settings.imageArray[i][e] = img_src; //Store image location in 'imageArray' variable
few lines above (From which is 'e' and 'i')
Код:
var img_src, $this = null;
this.each(function(e) {
$this = $(this);
if(settings.thumbnailSize != '0')
{
this.find('img').css({
'height':settings.thumbnailSize + 'px',
});
}
//Lets loop through each image in our element
$this.find('img').each(function(i) {
img_src = $(this).attr('src'); //Store image location in variable 'img_src'
how I defined the imageArray
Код:
settings = jQuery.extend({
overlay: 'rgba(0, 0, 0, 0.5)', //Overlay color (Must be in rgba if you want transparent background)
prevImage: 's32_viewer_prev.png', //Location to 'prev' image
nextImage: 's32_viewer_next.png', //Location to 'next' image
imageEffect: 'none', //How will image display ('none' or 'fade')
fadeSpeed: 'slow', //If we use 'fade' effect specifie the fade speed
imageBoxShadow: 'rgba(0, 0, 0, 0.5)', //Shadow that display around image
thumbnailSize: '0', //How big will image be (Thumbnail). Leave 0 if you don't want resize image
imageArray: [[]], //Don't touch this
currentImage: 0, //Don't touch this
originalHeight: 0, //Don't touch this
}, settings);
Thanks for help!