Commit 42202520 by Felix Sun

Fixed terribly annoying issues with back button. Back button is now on

the bottom of the hint div, no matter what.
parent 2d1c9158
...@@ -37,8 +37,3 @@ ...@@ -37,8 +37,3 @@
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
.bottom {
position: absolute;
bottom: 0;
}
\ No newline at end of file
...@@ -48,7 +48,7 @@ class @Hinter ...@@ -48,7 +48,7 @@ class @Hinter
else else
@$(target).css('display', 'none') @$(target).css('display', 'none')
# Fix positioning errors with the bottom class. # Fix positioning errors with the bottom class.
@$('.bottom').removeClass('bottom').addClass('bottom') @set_bottom_links()
vote: (eventObj) => vote: (eventObj) =>
# Make an ajax request with the user's vote. # Make an ajax request with the user's vote.
...@@ -87,6 +87,15 @@ class @Hinter ...@@ -87,6 +87,15 @@ class @Hinter
@$('#blank-answer').html(@answer) @$('#blank-answer').html(@answer)
@go_to('p3') @go_to('p3')
set_bottom_links: =>
# Makes each .bottom class stick to the bottom of .wizard-viewbox
@$('.bottom').css('margin-top', '0px')
viewbox_height = parseInt(@$('.wizard-viewbox').css('height'), 10)
@$('.bottom').each((index, obj) ->
view_height = parseInt($(obj).parent().css('height'), 10)
$(obj).css('margin-top', (viewbox_height - view_height) + 'px')
)
render: (content) => render: (content) =>
if content if content
# Trim leading and trailing whitespace # Trim leading and trailing whitespace
...@@ -127,8 +136,10 @@ class @Hinter ...@@ -127,8 +136,10 @@ class @Hinter
translate_string = 'translateX(' +id_to_index[view_id] * -1 * parseInt($('#' + view_id).css('width'), 10) + 'px)' translate_string = 'translateX(' +id_to_index[view_id] * -1 * parseInt($('#' + view_id).css('width'), 10) + 'px)'
@$('.wizard-container').css('transform', translate_string) @$('.wizard-container').css('transform', translate_string)
@$('.wizard-container').css('-webkit-transform', translate_string) @$('.wizard-container').css('-webkit-transform', translate_string)
@set_bottom_links()
legacy_go_to: (view_id) -> legacy_go_to: (view_id) ->
# For older browsers - switch wizard views by changing the screen. # For older browsers - switch wizard views by changing the screen.
@$('.wizard-view').css('display', 'none') @$('.wizard-view').css('display', 'none')
@$('#' + view_id).css('display', 'block') @$('#' + view_id).css('display', 'block')
\ No newline at end of file @set_bottom_links()
\ No newline at end of file
...@@ -77,9 +77,9 @@ ...@@ -77,9 +77,9 @@
<a class="answer-choice" href="javascript: void(0)" value="${answer}">${answer}</a><br /> <a class="answer-choice" href="javascript: void(0)" value="${answer}">${answer}</a><br />
% endfor % endfor
% if hints_exist: % if hints_exist:
<!-- A placeholder for the Back button, which is relatively-positioned --> <p class="bottom">
<p> &nbsp </p> <a href="javascript: void(0);" class="wizard-link" dest="p1"> Back </a>
<a href="javascript: void(0);" class="wizard-link bottom" dest="p1"> Back </a> </p>
% endif % endif
</div> </div>
...@@ -127,8 +127,9 @@ Write your hint here. Please don't give away the correct answer. ...@@ -127,8 +127,9 @@ Write your hint here. Please don't give away the correct answer.
<a href="http://www.apa.org/education/k12/misconceptions.aspx?item=2" target="_blank">Learn even more</a> <a href="http://www.apa.org/education/k12/misconceptions.aspx?item=2" target="_blank">Learn even more</a>
</p> </p>
</div> </div>
<br /> <p class="bottom">
<a href="javascript: void(0);" class="wizard-link" dest="p2"> Back </a> <a href="javascript: void(0);" class="wizard-link" dest="p2"> Back </a>
</p>
</div> </div>
<!-- Close wizard contaner and wizard viewbox. --> <!-- Close wizard contaner and wizard viewbox. -->
</div></div> </div></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment