I am working on a website, the navigation list of the website is in the picture. If I go to the page number 1, other pages are also shown as selected. But if I go to the page number 2 there is no problem.
Here is the code for navigation list. The list items shown as selected have different file names. How a list item now that it is selected ?
<nav class="sidebar sidebar-offcanvas" id="sidebar">
<ul class="nav">
<li class="nav-item">
<a class="nav-link" href="../index.php">
<i class="ti-dashboard menu-icon"></i>
<span class="menu-title">Ana Sayfa</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#kullanicilar" aria-expanded="false"
aria-controls="kullanicilar">
<i class="ti-id-badge menu-icon"></i>
<span class="menu-title">Kullanıcılar</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="kullanicilar">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link" href="kullanicilari-listele.php">Kullanıcılar</a></li>
<li class="nav-item"><a class="nav-link" href="kullanici-olustur.php">Kullanıcı
Oluştur</a></li>
<li class="nav-item"><a class="nav-link" href="kullanici-istatistikleri-listele.php">Kullanıcı
İstatistikleri</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#workouts" aria-expanded="false"
aria-controls="workouts">
<i class="ti-gallery menu-icon"></i>
<span class="menu-title">Antrenmanlar</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="workouts">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link" href="antrenmanlari-listele.php">Antrenmanlar</a></li>
<li class="nav-item"><a class="nav-link" href="antrenman-olustur.php">Antrenman Oluştur</a></li>
<li class="nav-item"><a class="nav-link" href="egzersizleri-listele.php">Tekil Egzersizler</a></li>
<li class="nav-item"><a class="nav-link" href="tekil-egzersiz-olustur.php">Tekil</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#pilates" aria-expanded="false"
aria-controls="pilates">
<i class="ti-timer menu-icon"></i>
<span class="menu-title">Pilates</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="pilates">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link" href="pilates-egzersiz-setleri.php">Egzersiz Setleri</a></li>
<li class="nav-item"><a class="nav-link" href="pilates-egzersiz-seti-olustur.php">Egzersiz Seti Oluştur</a></li>
<li class="nav-item"><a class="nav-link" href="pilates-tekil-egzersizleri.php">Tekil Egzersizler</a></li>
<li class="nav-item"><a class="nav-link" href="pilates-tekil-egzersiz-olustur.php">Tekil</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#yoga" aria-expanded="false"
aria-controls="yoga">
<i class="ti-eye menu-icon"></i>
<span class="menu-title">Yoga</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="yoga">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link" href="yoga-egzersiz-setleri.php">Egzersiz Setleri</a></li>
<li class="nav-item"><a class="nav-link" href="yoga-egzersiz-seti-olustur.php">Egzersiz Seti Oluştur</a></li>
<li class="nav-item"><a class="nav-link" href="yoga-tekil-egzersizleri.php">Tekil Egzersizler</a></li>
<li class="nav-item"><a class="nav-link" href="yoga-tekil-egzersiz-olustur.php">Tekil Egzersiz Oluştur</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#streching" aria-expanded="false"
aria-controls="streching">
<i class="ti-hand-open menu-icon"></i>
<span class="menu-title">Streching</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="streching">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link" href="streching-egzersiz-setleri.php">Egzersiz Setleri</a></li>
<li class="nav-item"><a class="nav-link" href="streching-egzersiz-seti-olustur.php">Yeni Egzersiz Seti</a></li>
<li class="nav-item"><a class="nav-link" href="kstreching-tekil-egzersizleri.php">Tekil Egzersizler</a></li>
<li class="nav-item"><a class="nav-link" href="streching-tekil-egzersiz-olustur.php">Yeni Egzersiz</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#sporKategorileri" aria-expanded="false"
aria-controls="sporKategorileri">
<i class="ti-star menu-icon"></i>
<span class="menu-title">Kategoriler</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="sporKategorileri">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link" href="kategorileri-listele.php">Kategoriler</a></li>
<li class="nav-item"><a class="nav-link" href="kategori-olustur.php">Yeni Kategori Oluştur</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#egzersizEkipmanlari" aria-expanded="false"
aria-controls="egzersizEkipmanlari">
<i class="ti-basketball menu-icon"></i>
<span class="menu-title">Egzersiz</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="egzersizEkipmanlari">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link"
href="egzersiz-ekipmanlari-listele.php">Ekipmanlar</a></li>
<li class="nav-item"><a class="nav-link" href="egzersiz-ekipmani-olustur.php">Yeni Ekipman
Oluştur</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#vucutBolgeleri" aria-expanded="false"
aria-controls="vucutBolgeleri">
<i class="ti-heart menu-icon"></i>
<span class="menu-title">Vücut Bölgeleri</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="vucutBolgeleri">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link"
href="vucut-bolgeleri-listele.php">Vücut Bölgeleri</a></li>
<li class="nav-item"><a class="nav-link" href="vucut-bolgesi-olustur.php">Vücut Bölgesi
Oluştur</a></li>
</ul>
</div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#urunler" aria-expanded="false"
aria-controls="urunler">
<i class="ti-package menu-icon"></i>
<span class="menu-title">Ürünler</span>
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="urunler">
<ul class="nav flex-column sub-menu">
<li class="nav-item"><a class="nav-link" href="urunleri-listele.php">Ürünler</a></li>
<li class="nav-item"><a class="nav-link" href="urun-olustur.php">Yeni Ürün Oluştur</a>
</li>
<li class="nav-item"><a class="nav-link" href="urun-istatistikleri-listele.php">Ürün
İstatistikleri</a></li>
</ul>
</div>
</li>
</ul>
</nav>
'''
This is the page number 1
<?php
ob_start();
session_start();
if (!isset($_SESSION["login"])) {
header("Location: ../login.php");
} else {
include "veritabani/baglanti.php";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Online Gym Fitness Mobil Uygulama Yönetim Paneli</title>
<!-- plugins:css -->
<link rel="stylesheet" href="../vendors/ti-icons/css/themify-icons.css">
<link rel="stylesheet" href="../vendors/base/vendor.bundle.base.css">
<!-- endinject -->
<!-- inject:css -->
<link rel="stylesheet" href="../css/style.css">
<!-- endinject -->
<link rel="shortcut icon" href="../images/favicon.png"/>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="../js/repeater.js" type="text/javascript"></script>
</head>
<body>
<div class="container-scroller">
<!-- partial:../../partials/_navbar.html -->
<nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
<div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
<a class="navbar-brand brand-logo mr-xl-5" href="../index.php"><img src="../images/logo.png" class="mr-2"
alt="logo"/></a>
<a class="navbar-brand brand-logo-mini" href="../index.php"><img src="../images/logo-mini.png" alt="logo"/></a>
</div>
<div class="navbar-menu-wrapper d-flex align-items-center justify-content-end">
<button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
<span class="ti-view-list"></span>
</button>
<ul class="navbar-nav navbar-nav-right">
<li class="nav-item nav-profile dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" id="profileDropdown">
<img src="../images/faces/user.png" alt="profile"/>
</a>
<div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="profileDropdown">
<a class="dropdown-item" href="veritabani/logout.php">
<i class="ti-power-off text-primary"></i>
Logout
</a>
</div>
</li>
</ul>
<button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button"
data-toggle="offcanvas">
<span class="ti-view-list"></span>
</button>
</div>
</nav>
<!-- partial -->
<div class="container-fluid page-body-wrapper">
<!-- partial:../partials/_sidebar.html -->
<?php
include "navbar.html";
?>
<!-- partial -->
<div class="main-panel">
<div class="content-wrapper">
<div class="row">
<div class="col-lg-9 grid-margin">
<div class="card">
<div class="card-body">
<h4 class="card-title">Yeni Tekil Egzersiz</h4>
<p class="card-description">
Yeni Tekil Egzersiz Oluşturma Formu
</p>
<form method="post" name="egzersizOlusturmaFormu" id="egzersizOlusturmaFormu"
class="forms-sample">
<div class="form-group">
<label for="egzersizBasligi">Egzersiz Başlığı</label>
<input type="text" class="form-control" id="egzersizBasligi"
name="egzersizBasligi"
required="required"
>
</div>
<div class="form-group">
<label for="egzersizAltBaslik">Egzersiz Alt Başlık</label>
<input type="text" class="form-control" id="egzersizAltBaslik"
name="egzersizAltBaslik"
required="required"
>
</div>
<div class="form-group">
<label for="egzersizAciklama">Egzersiz Açıklama</label>
<input type="text" class="form-control" name="egzersizAciklama"
id="egzersizAciklama"
required="required">
</div>
<div class="form-group">
<label for="egzersizPremium">Premium içerik mi ?</label>
<select class="form-control form-control"
name="egzersizPremium" id="egzersizPremium">
<option value="1">Evet</option>
<option value="0">Hayır</option>
</select>
</div>
<div class="form-group">
<label for="egzersizVideoUrl">Video Embed Url</label>
<input type="text" class="form-control"
name="egzersizVideoUrl" id="egzersizVideoUrl"
required="required">
</div>
<div class="form-group">
<label for="egzersizPopularite">Popülarite Skoru</label>
<input type="text" class="form-control"
name="egzersizPopularite" id="egzersizPopularite">
</div>
<div class="form-group">
<label for="egzersizEkipmanKategorisi">Ekipman Kategorisi</label>
<select class="form-control form-control" name="egzersizEkipmanKategorisi"
id="egzersizEkipmanKategorisi">
<?php
$sorgu = "SELECT name,id FROM equipments ORDER BY name DESC";
$sorguSonucu = mysqli_query($baglanti, $sorgu) or trigger_error("Hata: " . mysqli_error(), E_USER_ERROR);
if ($sorguSonucu) {
while ($equipment = mysqli_fetch_assoc($sorguSonucu)) {
echo "<option value='" . $equipment['id'] . "'>" . $equipment["name"] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group">
<label for="egzersizSporKategorisi">Kategori</label>
<select class="form-control form-control" name="egzersizSporKategorisi"
id="egzersizSporKategorisi">
<?php
$sorgu = "SELECT name,id FROM categories ORDER BY name DESC";
$sorguSonucu = mysqli_query($baglanti, $sorgu) or trigger_error("Hata: " . mysqli_error(), E_USER_ERROR);
if ($sorguSonucu) {
while ($sport = mysqli_fetch_assoc($sorguSonucu)) {
echo "<option value='" . $sport['id'] . "'>" . $sport['name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group">
<label for="egzersizVucutBolgesi">Vücut Bölgesi</label>
<select class="form-control form-control" name="egzersizVucutBolgesi"
id="egzersizVucutBolgesi">
<?php
$bodyPartsSql = "SELECT name,id FROM body_parts ORDER BY name DESC";
$bodyParts = mysqli_query($baglanti, $bodyPartsSql) or trigger_error("Hata: " . mysqli_error(), E_USER_ERROR);
if ($bodyParts) {
while ($part = mysqli_fetch_assoc($bodyParts)) {
echo "<option value='" . $part['id'] . "'>" . $part['name'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group">
<label for="egzersizZorlukDerecesi">Egzersiz Zorluk Derecesi</label>
<select class="form-control form-control"
name="egzersizZorlukDerecesi" id="egzersizZorlukDerecesi">
<option value="1">Çok Kolay</option>
<option value="2">Kolay</option>
<option value="3">Orta</option>
<option value="4">Zor</option>
<option value="5">Çok Zor</option>
</select>
</div>
<div class="form-group">
<label for="egzersizOrtalamaSure">Egzersiz Ortalama Süresi (Dakika)</label>
<input type="text" class="form-control form-control"
name="egzersizOrtalamaSure" id="egzersizOrtalamaSure"
required="required">
</div>
<div class="form-group">
<label for="egzersizSetTipi">Setler Tekrarlı mı Süreli mi ?</label>
<select class="form-control form-control"
name="egzersizSetTipi" id="egzersizSetTipi">
<option value="1">Tekrarlı</option>
<option value="2">Süreli</option>
</select>
</div>
<div id="repeater">
<div class="repeater-heading" align="right">
<button type="button" class="btn btn-primary repeater-add-btn">Set Ekle
</button>
</div>
<div class="items" data-group="exercise_sets">
<div class="item-content">
<div class="row">
<div class="form-group" style="margin-left: 15px">
<label>Tekrar Sayısı/Süresi (Saniye) </label>
<input type="text" class="form-control"
required="required"
data-skip-name="true"
data-name="tekrarSayilari[]"
>
</div>
<div class="form-group" style="margin-left: 20px">
<label>Dinlenme Süresi (Saniye)</label>
<input type="text" class="form-control"
required="required"
data-skip-name="true"
data-name="dinlenmeSureleri[]"
>
</div>
<div class="col-lg-2" style="margin-top:30px;" align="center">
<button id="remove-btn"
onclick="$(this).parents('.items').remove()"
class="btn btn-danger">Sil
</button>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<label>Tanıtım Görseli Yükle</label>
<input type="file" name="egzersizTanitimGorseli"
id="egzersizTanitimGorseli"
class="file-upload-default">
<div class="input-group col-xs-12">
<input type="text" class="form-control file-upload-info"
required="required"
disabled="">
<span class="input-group-append">
<button class="file-upload-browse btn btn-primary" type="button">Görsel Seç</button>
</span>
</div>
<img id="gorsel_preview">
</div>
<div style="margin-top: 20px">
<button type="submit" class="btn btn-primary mr-2">ONAYLA</button>
<button type="reset" class="btn btn-light">İPTAL</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
</div>
<!-- main-panel ends -->
</div>
<!-- page-body-wrapper ends -->
<!-- container-scroller -->
<!-- plugins:js -->
<script src="../vendors/base/vendor.bundle.base.js"></script>
<!-- endinject -->
<!-- inject:js -->
<script src="../js/off-canvas.js"></script>
<script src="../js/hoverable-collapse.js"></script>
<script src="../js/template.js"></script>
<script src="../js/todolist.js"></script>
<script src="../js/file-upload.js"></script>
<script src="../js/repeater.js"></script>
<script src="../js/jquery.validate.js"></script>
<script type="text/javascript">
$('#egzersizOlusturmaFormu').on('submit', function (e) {
e.preventDefault();
$.ajax({
url: 'veritabani/egzersiz-kayit.php', // Verileri Post Ettiğimiz dosya adı
type: 'POST', // Form Metodumuz
data: new FormData(this), // Form ile gelen verilerimiz
contentType: false,
processData: false,
beforeSend: function () {
// Form Post edildikten sonra yapılacak işlem
// $('#result').html('<div class="progress"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%;"><span class="sr-only">Lütfen Bekleyiniz....</span></div></div>');
},
success: function (data) {
// veritabani/etkinlik-ekle.php dosyamıza verilerin gönderildikten sonra işlem başarılı ise upload.php ile gelen sonuç değerini yazdıracağımız satır
alert(data);
$('#egzersizOlusturmaFormu')[0].reset(); // İşlem başarılı olduktan sonra formu sıfırlar
}
});
});
</script>
<script type="text/javascript">
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#gorsel_preview').attr('src', e.target.result).attr('style', 'margin-bottom: 25px; margin-top: 25px; height: 150px; width: 150px');
};
reader.readAsDataURL(input.files[0]);
}
}
$("#egzersizTanitimGorseli").change(function () {
readURL(this);
});
</script>
<script>
$(document).ready(function () {
$('#repeater').createRepeater();
});
</script>
<!-- endinject -->
</body>
</html>
Related
First of all, I will paste my whole html code here:
{% extends "base.html" %}
{% block content %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Postgresqlabfragen -->
</head>
<body>
<div class="container-fluid">
<div class="row">
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
<div class="position-sticky pt-3">
<ul class="nav flex-column">
<ul>
<li> <strong>Verfügbare Abfragen:</strong> </li>
</ul>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="{{url_for('server.epex')}}">
EPEX
</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="{{url_for('server.post')}}">
Show Partner
</a>
</li>
</ul>
</div>
</nav>
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">EPEX Strompreise</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group me-2">
</div>
<div class="dropdown">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">
Aktueller Stand
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" onclick="loadNewGraph(1)">Aktueller Stand</a></li>
<li><a class="dropdown-item" onclick="loadNewGraph(1)">Letzte Woche</a></li>
<li><a class="dropdown-item" onclick="loadNewGraph(2)">Maximum</a></li>
</ul>
</div>
</div>
</div>
<img id="graph" src="" width="900" height="600" >
<!-- <script src="{{ url_for('static', filename='EPEX_dashboard.js') }}"></script>-->
<script>
function loadNewGraph(id){
let req_url = '/postgresql/epex/get_graph/'
//if (window.location.href.includes("partner")){
// req_url = '/postgresql/partner/get_graph/'
//}
// ajax call to url get_graph, cf.: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
const xhttp = new XMLHttpRequest();
xhttp.open("GET", req_url + id, true);
xhttp.send();
xhttp.onload = function(e){
imgurl = document.getElementById('graph')
imgurl.src = '/static/Bilder/new_plot.png' + "?ts=" + Date.now()
}
}
loadNewGraph(0)
</script>
</body>
{% endblock %}
My problem is that I want to change the button name "Aktueller Stand" with the selected one.
In this case I have 3 possible selections:
'Aktueller Stand
Letzte Woche
Maximum'
But clicking on them still leaves in the window "Aktueller Stand". I didnt find a satysfying solution on the internet. Can you help me out guys?
Here is a photo of my linked Bootstrap Dropdownmenu:
https://ibb.co/gbKk53Z "dropdown menu"
Add an id to your button to use it in js. I said lnkButton, you can name anything.
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" id="lnkButton">
Add a text input to your function as the click options text :
function loadNewGraph(id, text){
...
Use this input to change the button text at the very bottom of your function
...
document.getElementById("lnkButton").innerText = text;
}
Add text input values into your link as their button text :
<li><a class="dropdown-item" onclick="loadNewGraph(0, 'Aktueller Stand')">Aktueller Stand</a></li>
<li><a class="dropdown-item" onclick="loadNewGraph(1, 'Letzte Woche')">Letzte Woche</a></li>
<li><a class="dropdown-item" onclick="loadNewGraph(2, 'Maximum')">Maximum</a></li>
Finally add the first button text as the initial value when you call your function:
loadNewGraph(0, 'Aktueller Stand');
You can pass the content of the clicked option as second parameter like this
<div class="dropdown">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">
Aktueller Stand
</button>
<ul class="dropdown-menu">
<li>
<!-- The keyword this refer to the a tag -->
<a class="dropdown-item" onclick="loadNewGraph(this, 0)">Aktueller Stand</a>
</li>
<li>
<a class="dropdown-item" onclick="loadNewGraph(this, 1)">Letzte Woche</a>
</li>
<li>
<a class="dropdown-item" onclick="loadNewGraph(this, 2)">Maximum</a>
</li>
</ul>
</div>
<img id="graph" src="" width="900" height="600" />
<script>
// Your dropdown button you can give an id for more specificity
let dropdownBtn = document.querySelector(".dropdown button");
function loadNewGraph(el, id) {
// Update label depending on what you click
dropdownBtn.innerText = el.innerText;
//.....
}
// Default option
loadNewGraph(dropdownBtn, 0);
</script>
Thank you Batu.Khan and the rest of community :-).
I post here my solution leaned on the answer of Batu.kha, which is now working wonderful.
{% extends "base.html" %}
{% block content %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- Postgresqlabfragen -->
</head>
<body>
<div class="container-fluid">
<div class="row">
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
<div class="position-sticky pt-3">
<ul class="nav flex-column">
<ul>
<li> <strong>Verfügbare Abfragen:</strong> </li>
</ul>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="{{url_for('server.epex')}}">
EPEX
</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="{{url_for('server.post')}}">
Show Partner
</a>
</li>
</ul>
</div>
</nav>
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">EPEX Strompreise</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group me-2">
</div>
<div class="dropdown">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" id="lnkButton">
Aktueller Stand
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" onclick="loadNewGraph(0,'Aktueller Stand')">Aktueller Stand</a></li>
<li><a class="dropdown-item" onclick="loadNewGraph(1, 'Letzte Woche')">Letzte Woche</a></li>
<li><a class="dropdown-item" onclick="loadNewGraph(2, 'Maximum')">Maximum</a></li>
</ul>
</div>
</div>
</div>
<img id="graph" src="" width="900" height="600" >
<!-- <script src="{{ url_for('static', filename='EPEX_dashboard.js') }}"></script>-->
<script>
function loadNewGraph(id,text){
let req_url = '/postgresql/epex/get_graph/'
//if (window.location.href.includes("partner")){
// req_url = '/postgresql/partner/get_graph/'
//}
// ajax call to url get_graph, cf.: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
const xhttp = new XMLHttpRequest();
xhttp.open("GET", req_url + id, true);
xhttp.send();
xhttp.onload = function(e){
imgurl = document.getElementById('graph')
imgurl.src = '/static/Bilder/new_plot.png' + "?ts=" + Date.now()
}
document.getElementById("lnkButton").innerText = text;
}
loadNewGraph(0, 'Aktueller Stand')
</script>
</body>
{% endblock %}
I'm making a multi-page form in Angular using nav-tabs and tab-content. I can switch between tabs, but content is not shown in any of the tabs. Before I added the fade to the tab-panes, the content of step 1 was shown in every step, so the fade might be one of the problems, but not the only one I think... Below is my code, any help is appreciated!
I got the html from this site: https://getbootstrap.com/docs/4.4/components/navs/#tabs
It would be amazing if it were possible to do these tabs and the links to them all in the same url (so not changing it), so if anyone knows how to do that (if it is possible), then you're amazing!
<nav>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="step1" data-toggle="tab" href="infotemplate/#step1" role="tab" aria-controls="step1" aria-selected="true">Step 1</a>
</li>
<li class="nav-item">
<a class="nav-link" id="step2" data-toggle="tab" href="infotemplate/#step2" role="tab" aria-controls="step2" aria-selected="false">Step 2</a>
</li>
</ul>
</nav>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" role="tabpanel" id="step1" aria-labelledby="step1">
<form [formGroup]="basicsform">
<div>
<div class="required-field">Full name:</div>
<input type="text" formControlName="name" placeholder="Full name">
</div>
<div>
Label:
<input type="text" formControlName="label" placeholder="Label">
</div>
<div>
<div class="required-field">E-mail:</div>
<input type="email" formControlName="email" placeholder="E-mail">
</div>
<div>
URL to picture:
<input type="url" formControlName="picture" placeholder="Picture URL">
</div>
<div>
<div class="required-field">Phone number:</div>
<input type="text" formControlName="phone" placeholder="Phone number">
</div>
<div>
URL to website:
<input type="url" formControlName="website" placeholder="Website URL">
</div>
<div>
Summary:
<input type="text" formControlName="summary" placeholder="Summary">
</div>
<div formGroupName="location">
<h6>Location</h6>
<div>
<div class="required-field">Address:</div>
<input type="text" formControlName="address" placeholder="Address">
</div>
<div>
<div class="required-field">City:</div>
<input type="text" formControlName="city" placeholder="City">
</div>
<div>
<div class="required-field">Postal Code:</div>
<input type="text" formControlName="postalCode" placeholder="Postal code">
</div>
<div>
<div class="required-field">Country code:</div>
<input type="text" formControlName="countryCode" placeholder="Country code">
</div>
<div>
Region:
<input type="text" formControlName="region" placeholder="Region">
</div>
</div>
</form>
</div>
<div class="tab-pane fade" role="tabpanel" id="step2" aria-labelledby="step2">
<form [formGroup]="basicsform">
<div formArrayName="profiles" *ngFor="let profile of basicsform.get('profiles').controls; let i = index;">
<div [formGroupName]="i">
<em><b>Profile {{i + 1}}:</b></em>
<div class="required-field">Network:</div>
<input type="text" formControlName="network" placeholder="Network">
<div class="required-field">Username:</div>
<input type="text" formControlName="username" placeholder="Username">
<div class="required-field">URL:</div>
<input type="text" formControlName="url" placeholder="URL"><br>
<button (click)="deleteProfile(i)">Delete Profile {{i+1}}</button><br>
</div><br><br>
</div><br>
<div><button (click)="addProfile()" [disabled]="basicsform.get('profiles').invalid">Add
profile</button></div><br>
</form>
</div>
Here is working code! Check in your application.
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link" id="contact-tab" data-toggle="tab" href="#contact" role="tab" aria-controls="contact" aria-selected="false">Contact</a>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">tab 1</div>
<div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">tab 2</div>
<div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">tab 3</div>
</div>
I use Bootstrap tabs and have a problem with forms when Names of Checkboxes are the same. Checkbox is not displayed in the other form. If to use 2 forms in the first tab everything goes well
<div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">
<a href="#tab1" aria-controls="ExportFSAClaims" role="tab" data-toggle="tab">
tab1
</a>
</li>
<li role="presentation">
<a href="#tab2" aria-controls="ExportFSABalances" role="tab" data-toggle="tab">
tab2
</a>
</li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="tab1">
<form action="url1" method="POST">
<input type="checkbox" name="IsTerminated" />
</form>
</div>
<div role="tabpanel" class="tab-pane" id="tab2">
<form action="url2" method="POST">
<input type="checkbox" name="IsTerminated" />
</form>
</div>
</div>
</div>
I have this problem:
(sorry for the Greek).
I want this dropdown menu, positioned on top of everything else on the page.
I don't think that I can use position:fixed, as I want the dropdown to always be below the blue button above it.
Here is the html (I'm using bootstrap):
https://jsfiddle.net/9pLg1kLy/2/
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<div class="navbar-default sidebar" role="navigation">
<div id="navbar-root-div" class="sidebar-nav navbar-collapse in">
<ul class="nav" id="side-menu">
<!--<sidebar-search></sidebar-search>-->
<li ng-show=currentUser ui-sref-active="active"> <a ui-sref="dashboard.map"><i class="fa fa-map fa-fw"></i> Χάρτης</a>
<!-- </li>
<li ng-show=currentUser ui-sref-active="active">
<a ui-sref="dashboard.chart"><i class="fa fa-line-chart fa-fw"></i> Δείκτες Απόδοσης</a>
</li>-->
<li id="deleteDevicePathsID" ng-show="devicePaths.p1" ui-sref-active="active"> </i> Διαγραφή Διαδρομών
</li>
<li ng-class="{active: collapseVar==1}" ng-cloak ng-show="devicesLoaded && currentUser">{{dropDown}} <a href="" ng-click="check(1)"><i class="fa fa-car fa-fw"></i> Συσκευές<span ng-show=DevicesArray
class="fa arrow"></span></a>
<ul id="deviceDataList" class="nav nav-second-level" collapse="collapseVar!=1">
<li ng-show=devicesLoaded class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" ng-model="searchText" placeholder="Αναζήτηση..."> <span class="input-group-btn">
<!--<button class="btn btn-primary dropdown" type="button"></button> -->
<div class="dropdown">
<a id="toolsDrop" href="" role="button"
class="dropdown-toggle btn btn-primary"
data-toggle="dropdown"
style="padding: 6px 6px 6px 8px;">Φίλτρα <b
class="caret"></b></a>
<ul class="dropdown-menu" style="min-width: 0; top: 34px; left: -20px;">
<li>
<a href="" style="padding: 6px; min-width: 0"
ng-click="statusFilter = movingFilter"> <img
src="misc/images/pinOntheMove.png"> Κινείται</a>
</li>
<li><a href="" style="padding: 6px;min-width: 0"
ng-click="statusFilter = stoppedFilter"> <img
src="misc/images/pinStopped.png"> Σε Στάση</a>
</li>
<li><a href="" style="padding: 6px;min-width: 0"
ng-click="statusFilter = unknownFilter"> <img
src="misc/images/pinUnknown.png"> Άγνωστο</a>
</li>
<li class="divider hidden-xs"></li>
<li><a href="" style="padding: 6px;min-width: 0"
ng-click="statusFilter = allFilter"> <i class="fa fa-th-list"></i> Όλα</a>
</li>
</ul>
</div>
</span>
</div>
</li>
<li>
<ul class="nav nav-second-level sidebar-device-list">
<li ng-init="third=!third" ng-class="{active: multiCollapseVar==3}" ng-repeat="device in DevicesArray | filter:dataFilter | filter:searchText | filter: statusFilter" id="{{device.DeviceId}}" lat="{{device.DeviceData.Position.Y}}" lng="{{device.DeviceData.Position.X}}" ui-sref-active="active"> <a style="font-weight:bold; border-style: none none solid none;" href="" ng-click="CenterMapOnPosition(device.DeviceData.Position, device.DeviceData.DeviceId)"><img
width="26"
height="26"
ng-src="misc/images/pin{{device.DeviceData.State}}.png">
{{device.Name}} <p style="font-weight: normal; color: #002a80">{{device.DeviceData.Location}}</p></a>
</li>
</ul>
</li>
</ul>
<li ng-show="devicesLoaded && currentUser" ui-sref-active="active"> </i><i ng-hide="labelsShown" class="fa fa-square-o fa-fw"></i> Ονόματα Οχημάτων
</li>
<li ng-show=currentUser ui-sref-active="active"> </i> Αποσύνδεση
</li>
</ul>
</div>
</div>
The dropdown menu is at line 32.
Try to add z-index with position:relative that's make it visible
Try adding a z-index on the element which is cut off. This will bring the element to the front
I'm kinda new to HTML/CSS, and I'm trying to create a page with a login dropdown, but for some reason there's no padding on the right side of it. How can I fix it?
I wasn't able to find a solution.
<div class="navbar navbar-fixed-top navbar-default">
<div class="navbar-header"><a class="navbar-brand">My Site</a>
<a class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="glyphicon glyphicon-bar"></span>
<span class="glyphicon glyphicon-bar"></span>
<span class="glyphicon glyphicon-bar"></span>
</a>
</div>
<div class="container">
<div class="navbar-collapse">
<ul class="nav pull-right navbar-nav">
<li>Sign Up
</li>
<li class="divider-vertical"></li>
<li class="dropdown"> <a class="dropdown-toggle" href="#" data-toggle="dropdown">Sign In <strong class="caret"></strong></a>
<div class="dropdown-menu" style="padding: 10px;min-width:240px;">
Login via
<div class="social-buttons">
<i class="fa fa-facebook"></i> Facebook
</div>
or
<form action="[YOUR ACTION]" method="post" role="form" class="form-horizontal">
<input class="form-control" id="inputEmail1" placeholder="Email" type="email" style="margin-bottom:.5em">
<input class="form-control" id="inputPassword1" placeholder="Password" type="password" style="margin-bottom:.5em">
<div class="checkbox">
<label>
<input type="checkbox">Remember me</label>
</div>
<input class="btn btn-primary" style="margin-top:.75em;width: 100%; height: 32px; font-size: 13px;" type="submit" name="commit" value="Sign In">
</form>
</div>
</li>
</ul>
</div>
</div>
</div>
As Bootstrap Documentation says, sometimes you will need to place your dropdown container in a different position, for those cases you need to add the dropdown-menu-right class like so:
<div class="dropdown-menu dropdown-menu-right" style="padding: 10px;min-width:240px;">
Here's a JSFiddle with the example working:
JSFiddle
Your HTML structure should be changed to reflect the base Bootstrap classes. Pull-right isn't respected in the way you're using it, use navbar-right instead. Check the Docs to see the options you have by default.
*Also this class doesn't exist > <span class="glyphicon glyphicon-bar"></span>
See working example Snippet.
.navbar .dropdown-menu-fb {
padding: 10px;
min-width: 240px;
}
.navbar .navbar-toggle {
padding: 5px 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="navbar navbar-fixed-top navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-nav" aria-expanded="false"> <i class="fa fa-bars"></i>
</button>My Site
</div>
<div class="collapse navbar-collapse" id="bs-nav">
<ul class="nav navbar-nav navbar-right">
<li>Sign Up
</li>
<li class="dropdown"> <a class="dropdown-toggle" href="#" data-toggle="dropdown">Sign In <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-fb">
<li class="btn btn-default navbar-btn btn-block"> <i class="fa fa-facebook"></i> Login via Facebook
</li>
<li>
<form action="[YOUR ACTION]" method="post" role="form">
<p class="text-center">or Sign Up</p>
<div class="form-group">
<input class="form-control" id="inputEmail1" placeholder="Email" type="email">
</div>
<div class="form-group">
<input class="form-control" id="inputPassword1" placeholder="Password" type="password">
</div>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox">Remember me</label>
</div>
</div>
<div class="form-group">
<input class="btn btn-primary navbar-btn btn-block" type="submit" name="commit" value="Sign In">
</div>
</form>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
The container is too big and it go out of the screen?
Work on min-width and let container stay inside the viewport, than focus on padding.
<div class="dropdown-menu" style="padding: 10px;min-width:200px;">
probably you will have to work on dropdown-menu to fix it, we need the css code