Код: Выделить всё
// Your database connection and other PHP code
// Query to retrieve the minimum and maximum publication years
$query = "SELECT MIN(YEAR(data)) AS min_year, MAX(YEAR(data)) AS max_year FROM publicacoes";
$stmt = $pdo->prepare($query);
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
// Retrieve the minimum and maximum years from the query result
$minYear = $result['min_year'];
$maxYear = $result['max_year'];
Код: Выделить всё
// JavaScript function to update the displayed value when slider changes
function updateSliderValue() {
var slider = document.getElementById("yearSlider");
var selectedYearDisplay = document.getElementById("selectedYearDisplay");
// Update the displayed value
selectedYearDisplay.innerText = slider.value;
}
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/78468372/how-can-i-define-specific-values-in-a-range-slider[/url]