Archive
Posts Tagged ‘anchor’
[flask] render a template and jump to an anchor
September 6, 2015
Leave a comment
Problem
You render a page but you want to jump to an anchor on the rendered page.
Solution
Here is a route:
@app.route('/about/')
def fn_about():
return render_template('about.html')
In the view add this (assuming you have jQuery):
<script> $(function(){ window.location.hash = "jump_here"; }); </script>
It’ll run once the HTML is loaded. Found it here.
Categories: flask, python
anchor, jquery, render_template
