|
1 | 1 | {% load bootstrap3 %} |
2 | 2 |
|
3 | 3 | {% bootstrap_css %} |
| 4 | + |
| 5 | +<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> |
| 6 | + |
4 | 7 | {% bootstrap_javascript %} |
5 | 8 |
|
6 | 9 | <link href='http://fonts.googleapis.com/css?family=Roboto:300' rel='stylesheet' type='text/css'> |
|
14 | 17 | background-color:#E0E0E0; |
15 | 18 | color:#500000; |
16 | 19 | } |
| 20 | + |
| 21 | + |
| 22 | +#search { |
| 23 | + position: fixed; |
| 24 | + top: 0px; |
| 25 | + left: 0px; |
| 26 | + width: 100%; |
| 27 | + height: 100%; |
| 28 | + background-color: rgba(0, 0, 0, 0.7); |
| 29 | + |
| 30 | + -webkit-transition: all 0.5s ease-in-out; |
| 31 | + -moz-transition: all 0.5s ease-in-out; |
| 32 | + -o-transition: all 0.5s ease-in-out; |
| 33 | + -ms-transition: all 0.5s ease-in-out; |
| 34 | + transition: all 0.5s ease-in-out; |
| 35 | + |
| 36 | + -webkit-transform: translate(0px, -100%) scale(0, 0); |
| 37 | + -moz-transform: translate(0px, -100%) scale(0, 0); |
| 38 | + -o-transform: translate(0px, -100%) scale(0, 0); |
| 39 | + -ms-transform: translate(0px, -100%) scale(0, 0); |
| 40 | + transform: translate(0px, -100%) scale(0, 0); |
| 41 | + |
| 42 | + opacity: 0; |
| 43 | +} |
| 44 | + |
| 45 | +#search.open { |
| 46 | + -webkit-transform: translate(0px, 0px) scale(1, 1); |
| 47 | + -moz-transform: translate(0px, 0px) scale(1, 1); |
| 48 | + -o-transform: translate(0px, 0px) scale(1, 1); |
| 49 | + -ms-transform: translate(0px, 0px) scale(1, 1); |
| 50 | + transform: translate(0px, 0px) scale(1, 1); |
| 51 | + opacity: 1; |
| 52 | +} |
| 53 | + |
| 54 | +#search input[type="search"] { |
| 55 | + position: absolute; |
| 56 | + top: 50%; |
| 57 | + width: 100%; |
| 58 | + color: rgb(255, 255, 255); |
| 59 | + background: rgba(0, 0, 0, 0); |
| 60 | + font-size: 60px; |
| 61 | + font-weight: 300; |
| 62 | + text-align: center; |
| 63 | + border: 0px; |
| 64 | + margin: 0px auto; |
| 65 | + margin-top: -51px; |
| 66 | + padding-left: 30px; |
| 67 | + padding-right: 30px; |
| 68 | + outline: none; |
| 69 | +} |
| 70 | +#search .btn { |
| 71 | + position: absolute; |
| 72 | + top: 50%; |
| 73 | + left: 50%; |
| 74 | + margin-top: 61px; |
| 75 | + margin-left: -45px; |
| 76 | +} |
| 77 | +#search .close { |
| 78 | + position: fixed; |
| 79 | + top: 15px; |
| 80 | + right: 15px; |
| 81 | + color: #fff; |
| 82 | + background-color: #428bca; |
| 83 | + border-color: #357ebd; |
| 84 | + opacity: 1; |
| 85 | + padding: 10px 17px; |
| 86 | + font-size: 27px; |
| 87 | +} |
| 88 | + |
17 | 89 | </style> |
| 90 | +<script> |
| 91 | +$(function () { |
| 92 | + $('a[href="#search"]').on('click', function(event) { |
| 93 | + event.preventDefault(); |
| 94 | + $('#search').addClass('open'); |
| 95 | + $('#search > form > input[type="search"]').focus(); |
| 96 | + }); |
| 97 | + |
| 98 | + $('#search, #search button.close').on('click keyup', function(event) { |
| 99 | + if (event.target == this || event.target.className == 'close' || event.keyCode == 27) { |
| 100 | + $(this).removeClass('open'); |
| 101 | + } |
| 102 | + }); |
| 103 | + |
| 104 | +}); |
| 105 | +</script> |
18 | 106 |
|
19 | 107 | <div class="container"> |
20 | 108 | <div class="page-header"> |
21 | | - <a class="btn btn-lg btn-danger pull-right" href="/add/">Ask Question</a><h1><a href="/">Simple QA </a><small>Open Questions</small></h1> |
| 109 | + <a class="btn btn-lg btn-warning pull-right" href="#search"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Find</a><a class="btn btn-lg btn-danger pull-right" href="/add/">Ask Question</a><h1><a href="/">Simple QA </a><small>Open Questions</small></h1> |
22 | 110 | </div> |
23 | 111 |
|
24 | 112 | {% if questions %} |
|
62 | 150 | <small><a href="/login">Login</a></small> |
63 | 151 | {% endif %} |
64 | 152 | | <a href="/admin">Admin Panel</a></small></center> |
| 153 | + <br/><br/> |
| 154 | + |
| 155 | + <div id="search"> |
| 156 | + <button type="button" class="close">×</button> |
| 157 | + <form method="post" action="/search/"> |
| 158 | + {% csrf_token %} |
| 159 | + <input type="search" value="" name="word" placeholder="type keyword(s) here" /> |
| 160 | + <input class="btn btn-lg btn-warning" type="submit" value="Find" /> |
| 161 | + </form> |
| 162 | + </div> |
0 commit comments