I came across a that displays all the images in a db in a form of slide
show. Every-time the user clicks a number a corresponding image appears.
The issue is that only the first image appears its title, every other image
that follows displays without its title but i need the titles to tell users
what they are looking at, I feel I am missing something in the view I just
cant put my finger on it!
*THE VIEW*
<script type="text/javascript"><!--
var last_image={{=len(images)}};
var curr_image=0;
function show_image(id,v){
var id2=id+'_title';
curr_image=v;
{{for i in range(len(images)):}}
if(v=={{=i}}) {
document.getElementById(id2).innerHTML='{{images[i].title}}'
document.getElementById(id).src='{{=URL('download
',args=[images[i].file])}}'
}
{{pass}}
}
function next_image(id) {
curr_image=(curr_image+1);
if(curr_image==last_image) curr_image=0;
show_image(id,curr_image);
}
//--></script>
<div class="row">
<div id="main">
<div id="gallery">
<h1>{{=title}}</h1>
<div id="navigation_content">
<ul class="navigation">
<li><a onclick="show_image('the_image',0);">«</a></li>
{{for i in range(len(images)):}}
<li><a onclick="show_image('the_image',{{=i}});">{{=i+1}}</a></li>
{{pass}}
<li><a onclick="show_image('the_image',last_image-1);">»
</a></li>
</ul>
<div class="clear"> </div>
</div>
<div id="image">
<h2 id="the_image_title">{{=images[0].title}}</h2><br/>
<img src="{{=URL('download',args=[images[0].file])}}"
id="the_image" name="image" width="700" height="489"
onclick="next_image('the_image');"/>
</div>
</div>
</div>
</div>
Regards;
Mostwanted
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/4a6b1de9-f74a-450f-a2c2-38634a863e10%40googlegroups.com.