Browse Source

Exercise: Showing timer in the top of the page see #5267

Julio Montoya 12 năm trước cách đây
mục cha
commit
bc726139b4

+ 4 - 0
main/inc/lib/javascript/epiclock/renderers/minute/epiclock.minute.css

@@ -15,3 +15,7 @@
 .time_warning_two {
     background-color: #FFD700; 
 }
+
+#exercise_clock_warning {
+    z-index: 10000;
+}

+ 6 - 1
main/template/default/layout/footer.tpl

@@ -62,7 +62,10 @@
 <script>
 /* Makes row highlighting possible */
 $(document).ready( function() {
+    //Chosen select
     $(".chzn-select").chosen();     
+    
+    //Table highlight
     $("form .data_table input:checkbox").click(function() {
         if ($(this).is(":checked")) {
             $(this).parentsUntil("tr").parent().addClass("row_selected");
@@ -71,11 +74,13 @@ $(document).ready( function() {
             $(this).parentsUntil("tr").parent().removeClass("row_selected");
         }    
     });
-
+    
+    //Tool tip (in exercises)
     var tip_options = {
         placement : 'right'
     }
     $('.boot-tooltip').tooltip(tip_options);
+   
 });
 </script>
 {% endraw %}

+ 28 - 4
main/template/default/layout/head.tpl

@@ -86,7 +86,7 @@ $(window).resize(function() {
 $(document).scroll(function() {
 
     // Top bar scroll effect
-    if ($('body').width() > 959) {     
+    if ($('body').width() > 959) {   
         if ($('.subnav').length) {
             if (!$('.subnav').attr('data-top')) {
                 // If already fixed, then do nothing
@@ -106,6 +106,28 @@ $(document).scroll(function() {
     } else {
         //$('.subnav .brand').hide();
     }
+    
+    
+    //Exercise warning fixed at the top
+    var fixed =  $("#exercise_clock_warning");
+    if (fixed.length) {        
+        if (!fixed.attr('data-top')) {
+            // If already fixed, then do nothing
+            if (fixed.hasClass('subnav-fixed')) return;
+            // Remember top position
+            var offset = fixed.offset();
+            fixed.attr('data-top', offset.top);
+            fixed.css('width', '100%');
+        }
+
+        if (fixed.attr('data-top') - fixed.outerHeight() <= $(this).scrollTop()) {
+            fixed.addClass('subnav-fixed');
+            fixed.css('width', '100%');
+        } else {
+            fixed.removeClass('subnav-fixed');
+            fixed.css('width', '200px');
+        }
+    }
 
     //Admin -> Settings toolbar
 
@@ -159,8 +181,10 @@ $(document).scroll(function() {
             }
         }
     }
-});
-
+}); 
+    
+    
+/*
 function isScrolledIntoView(elem) {
     var docViewTop = $(window).scrollTop();
     var docViewBottom = docViewTop + $(window).height();
@@ -169,7 +193,7 @@ function isScrolledIntoView(elem) {
     var elemBottom = elemTop + $(elem).height();
 
     return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
-}
+}*/
 
 
 $(function() {