I would like to give the background-image
it's own class so I can use the javascript code on it. However, if I remove it from the current div the background-image
can not be displayed because it is the background-image
for this div
.
This is the web2py View
:
{{extend 'layout.html'}}
{{for color in bg:}}
<div class="project_video" style="background-image: url('{{=URL('download', args=color.bg_picture)}}')">
{{pass}}
<video class="movie" style="width: 100%;" src="{{=URL('download', args=videos.clip)}}" autoplay poster="{{=URL('static', 'images/tabla_loading_poster.png')}}" onended=videoEnded()></video>
<div class="objects" hidden>
{{for pic in pics_objects:}}
<a href="{{=URL('pic_answer', args=pic.id)}}"><img src="{{=URL('download', args=pic.pictures)}}"/></a>
<audio autoplay src="{{=URL('static', 'images/pop.mp3')}}"></audio>
{{pass}}
</div>
</div>
Of course if I use the javascript on the project_video
class it will apply to the entire div
. not only to the background-image
.
This is the web2py Controller
for the above View
:
def game():
videos = db.vid(request.args(0,cast=int)) or redirect(URL('index'))
bg = db(db.back.owner_id==request.args(0)).select()
pics_objects = db(db.pic.owner_id==request.args(0,cast=int)).select()
return locals()
This is the javascript bellow but, as I mentioned, this will hide the whole div
and what I want to hide is the background-image
only:
<script>
$(function(){
$('.project_video').hide();
});
$(window).load(function() {
$('.project_video').delay(6000).show(0);
});
</script>
I would appreciate any advise.