Merge pull request #37 from mattbk/click-anytime

Add a transparent div on top of the image
This commit is contained in:
mattbk
2015-11-05 15:43:16 -06:00
3 changed files with 20 additions and 6 deletions

View File

@ -2,13 +2,23 @@ body {
padding-top: 40px; padding-top: 40px;
} }
#outside {
cursor: pointer;
z-index:10;
position:relative;
}
#rotator { #rotator {
//background: #dddddd;
background: #ffffff; background: #ffffff;
// 90vh is 90% of viewer height: http://stackoverflow.com/a/16837667/2152245 // 90vh is 90% of viewer height: http://stackoverflow.com/a/16837667/2152245
height:80vh; height:80vh;
overflow: hidden; width:auto;
//overflow: hidden;
cursor: pointer; cursor: pointer;
z-index:0;
position: absolute;
left: 0px;
top: 0px;
} }
#rotator img { #rotator img {
@ -16,4 +26,4 @@ body {
max-height:80vh; max-height:80vh;
width:auto; width:auto;
margin: 0; margin: 0;
} }

View File

@ -1,6 +1,6 @@
// Script settings. // Script settings.
var slideDuration = 500; var slideDuration = 600;
var blankDuration = 200; var blankDuration = 400;
// Script internals. // Script internals.
var $currentSlide; var $currentSlide;
@ -22,7 +22,7 @@ $(document).ready(function(){
startTime = d1.getTime(); startTime = d1.getTime();
$('#rotator').mousedown(function(event){ $('#outside').mousedown(function(event){
document.getElementById('xcoordinate').value = event.pageX - this.offsetLeft; document.getElementById('xcoordinate').value = event.pageX - this.offsetLeft;
document.getElementById('ycoordinate').value = event.pageY - this.offsetTop; document.getElementById('ycoordinate').value = event.pageY - this.offsetTop;
var d2 = new Date(); var endTime = d2.getTime(); var d2 = new Date(); var endTime = d2.getTime();

View File

@ -7,10 +7,14 @@
<div id="placeholder" class="well"> <div id="placeholder" class="well">
<p>Please wait while the images are loaded.</p> <p>Please wait while the images are loaded.</p>
</div> </div>
<div id="outside">
<!-- This hidden image keeps the div open and the right size, even when #rotator is hidden in change.js. -->
<img src="{{ imageWithElement}}" style="visibility:hidden; position:relative;">
<div id="rotator" class="hide"> <div id="rotator" class="hide">
<img src="{{ imageWithElement}}"> <img src="{{ imageWithElement}}">
<img src="{{ imageWithoutElement}}"> <img src="{{ imageWithoutElement}}">
</div> </div>
</div>
<form method="post" action="" name="changeform" id="changeform"> <form method="post" action="" name="changeform" id="changeform">
<input type="hidden" name="xcoordinate" id="xcoordinate" value="0"> <input type="hidden" name="xcoordinate" id="xcoordinate" value="0">
<input type="hidden" name="ycoordinate" id="ycoordinate" value="0"> <input type="hidden" name="ycoordinate" id="ycoordinate" value="0">