From 81c538d82ddf64387b189caf9800416916dd4692 Mon Sep 17 00:00:00 2001 From: Gopesh Tulsyan Date: Tue, 1 Jul 2014 22:10:29 +0530 Subject: [PATCH] Putting the js inside ready function --- app/views/conference/_gallery.html.haml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/views/conference/_gallery.html.haml b/app/views/conference/_gallery.html.haml index 4f04b20b..34959e63 100644 --- a/app/views/conference/_gallery.html.haml +++ b/app/views/conference/_gallery.html.haml @@ -15,18 +15,21 @@ :javascript - var count = 0; - $('#gallery-btn').click(function(){ - if(count == 0){ - $('#gallery').modal('show'); - $('#gallery .modal-body').append(''); - count +=1; - } - else{ - $('#gallery').modal('show'); - return false; - } + $(document).ready(function(){ + var count = 0; + $('#gallery-btn').click(function(){ + if(count == 0){ + $('#gallery').modal('show'); + $('#gallery .modal-body').append(''); + count +=1; + } + else{ + $('#gallery').modal('show'); + return false; + } + }); }); +