Browse Source

Added a little bit of JS to resize text on all pages.

Thomas Buck 7 years ago
parent
commit
68cee94dc8
No account linked to committer's email address
2 changed files with 42 additions and 0 deletions
  1. 28
    0
      page.html
  2. 14
    0
      static/css/style.css

+ 28
- 0
page.html View File

@@ -54,6 +54,12 @@
54 54
             <li><a href="http://xythobuz.de/git/">Git</a></li>
55 55
             <li><a href="http://xythobuz.de/lastmusic">🎵</a></li>
56 56
             <li><a href="http://xythobuz.de/printer.jpg">🔨</a></li>
57
+            <div class="fonts">
58
+                <li><span class="font-big">Text:</span></li>
59
+                <li><a class="dec" href="#"><span class="font-big">A</span><span class="font-small">A</span></a></li>
60
+                <li><a class="reset" href="#"><span class="font-big">A</span><span class="font-big">A</span></a></li>
61
+                <li><a class="inc" href="#"><span class="font-small">A</span><span class="font-big">A</span></a></li>
62
+            </div>
57 63
             <!--%
58 64
                 tmp = [p for p in page["lang_links"].iteritems()]
59 65
                 if len(tmp) > 1:
@@ -134,6 +140,28 @@
134 140
             print '});'
135 141
             print '</script>'
136 142
     %-->
143
+    <script type="text/javascript">
144
+        $(document).ready(function(){
145
+            var fontSize = parseInt($('body').css('font-size'), 10);
146
+            var initialFontSize = fontSize;
147
+            $('.inc').on('click', function() {
148
+                fontSize += 1;
149
+                $('body').css('font-size', fontSize + 'px');
150
+            })
151
+            $('.dec').on('click', function() {
152
+                if (fontSize > 1) {
153
+                    fontSize -= 1;
154
+                    $('body').css('font-size', fontSize + 'px');
155
+                }
156
+            })
157
+            $('.reset').on('click', function() {
158
+                if (fontSize != initialFontSize) {
159
+                    fontSize = initialFontSize;
160
+                    $('body').css('font-size', initialFontSize + 'px');
161
+                }
162
+            })
163
+        })
164
+    </script>
137 165
     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js"></script>
138 166
     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/1.2.18/js/lightgallery-all.min.js"></script>
139 167
     <script type="text/javascript">

+ 14
- 0
static/css/style.css View File

@@ -117,3 +117,17 @@ iframe[id^='twitter-widget-'] {
117 117
     width: 100%;
118 118
 }
119 119
 
120
+div.fonts {
121
+    float: right;
122
+    margin-top: 20px;
123
+    margin-right: 10px;
124
+}
125
+
126
+span.font-big {
127
+    font-size: 0.9em;
128
+}
129
+
130
+span.font-small {
131
+    font-size: 0.6em;
132
+}
133
+

Loading…
Cancel
Save