I am making a rails app where I want to show a modal popup div whenever I click on link_to 'Add new Progress' I tried to do it but didn't work out well. Javascript gives no errors I don't know what to do. please help anyone
my code = View file
.modal.fade#myModal
.mymodal-content
My content goes here
#main_div_index.row.clearfix
#index_sidebar_aims
%h4=link_to 'I have a new AIM' ,{'class':'opener','data-toggle':"modal" ,'data-target':"#myModal"}
%br
%h4=link_to 'I made progress' , aims_path
#index_progress_div.col-md-6.col-xs-6.col-sm-6
show feeds from :
my code = javascript
var open = $('.opener');
var modal = $('.mymodal');
open.onclick = function(){
modal.style.display='show';
}
my code css
.mymodal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.mymodal-content {
position: relative;
background-color: #fefefe; }
Aucun commentaire:
Enregistrer un commentaire