changeset 502:4658074c6191 Dev_main

Popup/Survey buttons now fixed position rather than calculated.
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Wed, 10 Feb 2016 12:14:25 +0000
parents 9a8ede168aba
children 58fd8bcc6620
files core.css core.js
diffstat 2 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/core.css	Wed Feb 10 12:02:25 2016 +0000
+++ b/core.css	Wed Feb 10 12:14:25 2016 +0000
@@ -50,7 +50,7 @@
 	 */
 	width: 50px;
 	height: 25px;
-	position: relative;
+	position: absolute;
 	border-radius: 5px;
 	border: #444;
 	border-width: 1px;
@@ -58,6 +58,16 @@
 	background-color: #fff;
 }
 
+button#popup-proceed {
+    bottom: 10px;
+    right: 10px;
+}
+
+button#popup-previous {
+    bottom: 10px;
+    left: 10px;
+}
+
 div.testHalt {
 	/* Specify any colouring during the test halt for pre/post questions */
 	background-color: rgba(0,0,0,0.5);
--- a/core.js	Wed Feb 10 12:02:25 2016 +0000
+++ b/core.js	Wed Feb 10 12:14:25 2016 +0000
@@ -480,21 +480,19 @@
 		this.popupContent.appendChild(this.popupResponse);
 		
 		this.buttonProceed = document.createElement('button');
+        this.buttonProceed.id = "popup-proceed";
 		this.buttonProceed.className = 'popupButton';
-		this.buttonProceed.position = 'relative';
-		this.buttonProceed.style.left = '390px';
 		this.buttonProceed.innerHTML = 'Next';
 		this.buttonProceed.onclick = function(){popup.proceedClicked();};
 		
 		this.buttonPrevious = document.createElement('button');
+        this.buttonPrevious.id = "popup-previous";
 		this.buttonPrevious.className = 'popupButton';
-		this.buttonPrevious.position = 'relative';
-		this.buttonPrevious.style.left = '10px';
 		this.buttonPrevious.innerHTML = 'Back';
 		this.buttonPrevious.onclick = function(){popup.previousClick();};
 		
-		this.popupContent.appendChild(this.buttonPrevious);
-		this.popupContent.appendChild(this.buttonProceed);
+		this.popup.appendChild(this.buttonPrevious);
+		this.popup.appendChild(this.buttonProceed);
 		
 		this.popup.style.zIndex = -1;
 		this.popup.style.visibility = 'hidden';
@@ -613,12 +611,6 @@
             }
 			this.popupResponse.appendChild(input);
 		}
-		var content_height = Number(this.popup.offsetHeight.toFixed());
-		content_height -= Number(this.popupContent.offsetHeight.toFixed());
-		content_height -=Number(this.buttonProceed.offsetHeight.toFixed());
-		content_height = content_height + "px";
-		this.buttonProceed.style.top = content_height;
-		this.buttonPrevious.style.top = content_height;
 		if(this.currentIndex+1 == this.popupOptions.length) {
 			if (this.node.location == "pre") {
 				this.buttonProceed.textContent = 'Start';