From fbf78ebb860853f7016f68ab05df30fcd165dc53 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Mon, 14 Jan 2013 14:46:46 +0900 Subject: [PATCH] gallery: adds function that set the index to value API Set current index if parameter is exist Change-Id: I22e3ede83330ac0485209840ba81d92b0d6c504f --- src/widgets/gallery/js/jquery.mobile.tizen.gallery.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/widgets/gallery/js/jquery.mobile.tizen.gallery.js b/src/widgets/gallery/js/jquery.mobile.tizen.gallery.js index 9c9937f..df47fd6 100755 --- a/src/widgets/gallery/js/jquery.mobile.tizen.gallery.js +++ b/src/widgets/gallery/js/jquery.mobile.tizen.gallery.js @@ -39,7 +39,7 @@ * refresh(index): refresh the widget, should be called after add or remove. (parameter: start index) * empty: remove all of images from the gallery * length: get length of images - * value: get current index of gallery + * value(index): get or set current index of gallery (parameter: index of image) * * Events * @@ -127,10 +127,11 @@ */ /** @method value - The value method is used to get current index of gallery. + The value method is used to get or set current index of gallery. The image_index attribute defines the index of the image to be set. If not get current index. value = $("#gallery").gallery('value'); + $("#gallery").gallery('value', [image_index]); */ (function ( $, window, undefined ) { $.widget( "tizen.gallery", $.mobile.widget, { @@ -661,8 +662,12 @@ return this.images.length; }, - value: function () { - return this.index; + value: function ( index ) { + if ( index === undefined ) { + return this.index; + } + + this.refresh( index ); } }); /* End of widget */ -- 2.7.4