JQuery UI datepicker with arrow pointing the input

Developer
Size
2,246 Kb
Views
50,600

How do I make an jquery ui datepicker with arrow pointing the input?

What is a jquery ui datepicker with arrow pointing the input? How do you make a jquery ui datepicker with arrow pointing the input? This script and codes were developed by Berkin on 10 September 2022, Saturday.

JQuery UI datepicker with arrow pointing the input Previews

JQuery UI datepicker with arrow pointing the input - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>jQuery UI datepicker with arrow pointing the input</title> <link rel='stylesheet prefetch' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <input type="text" class="js-datepicker" />
<input type="text" class="js-datepicker r" />
<input type="text" class="js-datepicker r b" />
<input type="text" class="js-datepicker b" />
<input type="text" class="js-datepicker c " />
<input type="text" class="js-datepicker c b " /> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

JQuery UI datepicker with arrow pointing the input - Script Codes CSS Codes

input { position: absolute;
}
.c { left: 50%;
}
.r { right: 0; left: auto;
}
.b { bottom: 0;
}

JQuery UI datepicker with arrow pointing the input - Script Codes JS Codes

function drawArrow(input) { var $input = $(input), widget = $input.datepicker('widget'), direction; setTimeout(function() { console.log($input.offset()); console.log(widget.offset()); var inputOffset = $input.offset(), widgetOffset = widget.offset(); direction = inputOffset.top > widgetOffset.top ? 'down' : 'up'; widget.addClass('direction-' + direction); var arrow = widget.find('.datepicker-arrow'); if ( !arrow.length ) { arrow = $('<div class="datepicker-arrow"/>') .css({ width: 0, height: 0, borderStyle: 'solid', margin: '0 10px', position: 'absolute', }).appendTo(widget); } arrow.css({ left: inputOffset.left - widgetOffset.left, borderColor: direction === 'up' ? 'transparent transparent red' :'red transparent transparent' , borderWidth: direction === 'up' ? '0 10px 10px 10px' : '10px 10px 0 10px', top: direction === 'up' ? '-10px' : 'auto', bottom: direction === 'up' ? 'auto' : '-10px' }); }, 10);
}
$('.js-datepicker').datepicker({ format: 'dd.mm.yyyy', beforeShow: function(input, inst) { drawArrow(input); }, onChangeMonthYear: function(a,b) { console.log(this, a,b); var $input = $(this), widget = $(this).datepicker('widget'); drawArrow(this); }
});
JQuery UI datepicker with arrow pointing the input - Script Codes
JQuery UI datepicker with arrow pointing the input - Script Codes
Home Page Home
Developer Berkin
Username berkin
Uploaded September 10, 2022
Rating 3
Size 2,246 Kb
Views 50,600
Do you need developer help for JQuery UI datepicker with arrow pointing the input?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Berkin (berkin) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!