I have a floating image with an image link were you can go to the home page and when you hover over it a "zoom out" icon appears over it so you can minimize this image and move it into de navigation bar. This floating fixed image is shared in all views, it's in the application.html.erb file. The HTML looks like this:
<div class="col-sm-12 profile-float-container">
<div class="profile-float-wrapper">
<span class="glyphicon glyphicon-zoom-out minimize"></span>
<a href="/">
<img class="img-circle profile-nav-img" src="/system/users/avatars/000/000/004/small/dog.jpg?1438125939" alt="Dog">
</a>
</div>
</div>
It works. However, when this happens, the javascript is completely disabled after jumping to any other page in the app.
This is the javascript, located in application.js:
$(function() {
$('.minimize').on('click', function() {
$('.profile-float-wrapper').fadeOut();
$('.profile-nav-li').fadeIn();
});
$('div, span').on('click', function() {
alert($(this).attr('class'));
});
});
To explain what happens, first when the floating image is clicked the alerts pop out, and of course the effects work. However, after that when navigating through the app clicking any div or span doesn't trigger any alert. It's like the javascript is not being loaded.