Interactive input forms

This commit is contained in:
Raelon Masters
2020-06-27 17:32:40 -04:00
parent c7a3fcf4c7
commit 83c32d44c2
2 changed files with 18 additions and 2 deletions

View File

@@ -16,6 +16,9 @@ $(document).ready(function(){
var nav_width = $('.nav_l').width(); // Get the width of our nav items
var cmp_height = window.screen.availHeight;
var max_height = win_height - (hdr_height + ftr_height) - (scr_height - win_height); // Set our available height
var u_string = "Username";
var p_string = "Password";
var s_string = "search by Title, Author, Tags, or Collections"
customlog([cmp_height]);
$(".search_submit").click(function(){
var query = $('.nav_search').val();
@@ -54,4 +57,18 @@ $(document).ready(function(){
$('#btn_collections').on('click', function (e){
$('.hidden.vert-nav.collections').toggle()
});
})
$('.input_box').on('click', function(){
$(this).attr("value","");
});
$('.input_box').focusout(function(){
if ($(this).hasClass('nav_search') && $(this).val() == "") {
$(this).attr("value", s_string);
}
if ($(this).attr("id") == "username" && $(this).val() == "") {
$(this).attr("value", u_string);
}
if ($(this).attr("id") == "password" && $(this).val() == "") {
$(this).attr("value", p_string);
}
});
});

View File

@@ -9,7 +9,6 @@ from django.http import JsonResponse
from django.shortcuts import HttpResponse, render # render_to_response
from django.utils.text import slugify
import json
import jsonpickle
from .models import Books, Collections, Navigation