I am trying to get bootstrap modal to work with my html/css slider, it is fetching the users previous purchases into the slider div and each order has an Ellipsis icon that brings up a modal with some options for that order, but in this case the modal is only popping up inside the <div class="slider">
but if I put the modal outside of the slider div then the modal doesn't show up at all, It seems to work fine on desktop but on mobile the modal will only open inside the slider,
I believe it's because my slider CSS is conflicting with my modal in some way, I'm assuming it's the display:flex;
So how can I work around this?
I tried messing with z-index to try and force the modal to the front regardless of device but it doesn't seem to work
I will include my CSS at the bottom of this question :)
UPDATE: I have created some images, This is the mobile version, you can see how the modal opens inside the div instead of outside of it.. https://ibb.co/Q639Zzy
Heres the desktop version working fine.. https://ibb.co/tb8Tc6S
<div class="slider">
<?php
$stmt = $dbh->prepare("SELECT * FROM `orders` WHERE `username` = '$userdetails' AND `confirmation` = 'Confirmed' ORDER BY `date` DESC");
$stmt->execute();
$fetchy = $stmt->fetchAll();
if (count($fetchy) == '0')
{
echo('<p>No previous orders..</p>');
}
else
{
foreach ($fetchy as $fetch) {
?>
<div class="slide" id="slide<?php echo $fetch['uid']; ?>">
<img src="/images/temp/<?php echo $fetch['prodimage']; ?>" style="width:80px;">
<!--- Button trigger modal --->
<i data-toggle="modal" data-target="#exampleModal<?php echo $fetch['uid']; ?>" class="fas fa-ellipsis-v"></i>
<!--- Modal --->
<div class="modal fade" id="exampleModal<?php echo $fetch['uid']; ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Order options</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
View Order
<br>
<form action="../../PHP/user_functions.php" method="POST">
<input type="hidden" value="<?php echo $_SESSION['usr_name']; ?>" name="username">
<input type="hidden" value="<?php echo $fetch['uid']; ?>" name="uid">
<input type="hidden" value="Cancelled" name="cancelopt">
<label style="cursor:pointer;text-decoration: underline;">
Cancel Order
<input type="submit" style="display:none;" name="cancel">
</label>
</form>
<form class="deleteorderchk" action="../PHP/user_functions.php" method="POST">
<input type="hidden" value="<?php echo $_SESSION['usr_name']; ?>" name="username">
<input type="hidden" value="<?php echo $fetch['uid']; ?>" name="uid">
<label style="cursor:pointer;text-decoration: underline;">
Delete from Recent Purchases
<input type="submit" style="display:none;" name="remove">
</label>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<?php
}}
?>
</div>
And here I have my CSS
<style type="text/css">
i.fa-ellipsis-v{
display: inline-block;
border-radius: 60px;
box-shadow: 0 0 2px #888;
padding: 0.5em 0.6em;
font-size: 14px;
}
.slider{
width:100%;
display:flex;
overflow-x:auto;
-webkit-overflow-scrolling:touch;
scroll-snap-type:x mandatory;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.slider::-webkit-scrollbar {
display:none;
}
.slide{
width:120px;
flex-shrink:0;
height:100%;
}
.slider > div{
scroll-snap-align:start;
}
</style>
Related
I have used following code to add a background image to my PHP file.
body {
background-image:url('background.png');
background-color: #F0F8FF;
}
But I can see the color only changed not the image. Can someone help me to solve this? Does this due to the image resolutions? I exported the image from microsoft powerpoint. Do I need to consider that as well? Are there any method to find whether the issue with my code or my picture.
I have pasted my whole code.
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Library Management System</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<br />
<div class="container" style="width:700px;">
<h3 align="center">Management System</h3><br />
<br />
<br />
<br />
<br />
<br />
<?php
if(isset($_SESSION['username']))
{
?>
<div align="center">
<h1>Welcome to Dialog G-Tech Library</h1><br />
<div class="bar" align="center">
Logout
</div>
</div>
<?php
}
else
{
?>
<div id="loginModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Login</h4>
</div>
<div class="modal-body">
<label>Username</label>
<input type="text" name="username" id="username" class="form-control" />
<br />
<label>Password</label>
<input type="password" name="password" id="password" class="form-control" />
<br />
<button type="button" name="login_button" id="login_button" class="btn btn-warning">Login</button>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
<br />
</body>
<style type="text/css">
.bar {
overflow: hidden;
background-color: #87CEEB;
}
.bar a {
float: left;
color: black;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.bar a:hover {
background-color: #ddd;
color: black;
}
body {
background-image:url('background.png');
background-color: #F0F8FF;
}
</style>
</html>
<div id="loginModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Login</h4>
</div>
<div class="modal-body">
<label>Username</label>
<input type="text" name="username" id="username" class="form-control" />
<br />
<label>Password</label>
<input type="password" name="password" id="password" class="form-control" />
<br />
<button type="button" name="login_button" id="login_button" class="btn btn-warning">Login</button>
</div>
</div>
</div>
</div>
Sometimes the cache won’t realize that changes have been made to your website. A hard refresh is a way of clearing the browser’s cache for a specific page, to force it to load the most recent version of a page. Sometimes, when changes are made to the website, they don’t register immediately due to caching. A hard refresh will usually fix this, though occasionally completely clearing the cache is necessary.
Right Click on the refresh button and click on Empty Cache and Hard Reload and check its working or not
There is a photo upload code. It loads the client's photo into the database. But the problem is that it can only upload one photo. If you upload a second photo, it simply replaces it by removing the old photo.
Photo upload form display code
<div class="col-md-2" style="width: 223px; float: right; margin-top: -210px;">
<div class="x_panel">
<span class="input-text" style="margin-right: 5px;">Include Photo (+)</span>
<input contenteditable="true" onchange="saveUpdate('medsoft','Inst_Int','photos','<?=$row['Int_Int'];?>',this.value);" style="margin-left: 5px;width: 30px" type="1checkbox" class="1js-switch" name="photo" value="<?= $row['photos'];?>"><? //= ($row['photos']=='+' ? 'checked' : null);?>
<div class="x_contenti">
<br><br>
<span class="input-text " >Photo</span>
<!-- <a style="height: 26px; margin-left: 10px;" href="###/kont.php?action=new_kod&rowkod=<?//=$row['Sch_Row']?>" class="jsdelete btn btn-warning btn-sm" data-alert="Add photo ? ">Add</a> -->
<br><br>
<a style="cursor:pointer;border:1px solid;padding:3px;background: #eee; float: right; margin-top: -35px;" data-ch="<?=$row['Count_Row']?>" data-toggle="modal" data-target="#myModal">
Upload a photo
</a>
<!--
<a style="cursor:pointer;border:1px solid;padding:2px;background: red;color:#fff;" href="/medsoft.php?action=del_foto&rowfoto=<?//=$row['Sn_Row']?>" class="jsdelete btn btn-warning btn-sm" data-alert="Delete photo ?">Delete photo</a>
-->
<?php
if ($row['Photo_dev']=='+') {
?>
<div style="border: 0px solid; ">
<img id="ch-pers-img<?=$row['Ch_Rs']?>" src="/images/<?=$row['Chs_Rs']?>.jpg?t=<?=time ()?>" width="189">
</div>
<?php
}
?>
</div>
</div>
</div>
Photo Upload Processing Code
<div class="modal fade " id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Photo Upload</h4>
</div>
<div class="modal body">
<div>
<form action="upplo.php" method="post" name="uplod" id="uplod" enctype="multipart/form-data">
<input type="file" name="filename"><br>
<br>
<input id="submit-card" type="button" form="uplod" value="Upload">
</form>
</div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
Photo upload code
<?php
mysql_set_charset('utf8',$db);
if($_FILES["filename"]["size"] > 2024*3*2024) {
echo ("File size exceeds three megabytes");
exit;
}
$success=[];
$errors=[];
foreach( $_FILES as $file ){
// Check if the file is loaded
if(is_uploaded_file($file["tmp_name"])) {
// If the file is uploaded successfully, move it
// from temporary directory to destination
if (move_uploaded_file($file["tmp_name"], "images/".intval($_GET['ch']).".jpg"))
$success[]=intval($_GET['ch']).".jpg"."?t=".time();
// $db = mysql_connect("localhost","armit_mit","oZ5hI7jID");
// mysql_select_db("armit_mit",$db);
$result_foto = mysql_query ("UPDATE `Persons` SET `Photos` = '+' where `Ch-Persons` = ".intval($_GET['ch'])."", $db);
} else {
$errors[] = "Error loading file ".intval($_GET['ch']).".jpg";
}
}
echo json_encode(['success'=>$success,'errors'=>$errors]);
?>
What needs to be done so that you can upload several photos at once.
The code also contains a code for displaying a photo, which is displayed when the + sign is specified in the database in the "fhotos" line.
You store all uploaded files under the same name:
if (move_uploaded_file($file["tmp_name"], "images/".intval($_GET['ch']).".jpg"))
If you want to use distinct names, you need to add something to the file name, like a unique ID or a counter, or any part from the original file name.
I am displaying cards horizontally on the screen. Each card a user can click on it, it rotates to the back side of the card and a button is there [click on it] to display information from mysql database, but it does not work.
I have not been able to find a solution. Tried using JavaScript to pass the information, but did not work.
<script>
function BusinessAdd($Bname) {
document.getElementById('BusName').value = $Bname
reference: //$row['BusinessName'];
}
</script>
<!-- Horizontally scroll the cards
**************************************************************** -->
<!-- read fabcustomerdata Table-->
<?php include "ReadFabCustomerTable.php"; ?>
<div class="middlecontainer">
<div class="row">
<?php
//$query="SELECT * FROM fabcustomerdata";
$result = mysqli_query($connection, $query);
if(!$result) {
die('Query FAILED' . mysqli_error($connection));
}
// - pull thru the Table
while($row = mysqli_fetch_assoc($result)) {
?>
<div class="col-lg-2 col-md-3">
<div class="flip-card"
onclick="this.classList.toggle('hover')">
<div class="flip-card-inner">
<div class="flip-card-front">
<img class='winpane' src="Vend-images/<?
php echo $row["WindowPane"]; ?>" alt=""/>
</div>
<div class="flip-card-back">
<input type="checkbox" class="checkbox"
id="<?php echo $row["checkboxid"];?>"
onclick="myChkBoxFunction('<?php echo $row["checkboxid"];
?>')" data-toggle="tooltip" data-placement="auto"
title="Check Box to save this Card" />
<?php
echo '<address>';
echo '<br />';
echo "<b style='font-
size:1.2rem'>".$row['BusinessName']."</b>";
echo "<br /><br />";
echo $row['OfficeAddress']."<br>";
echo $row['OfficeCity'].",".$row['OfficeState']."
".$row['OfficePostalCode']."<br />";
echo $row['OfficePhNo'];
echo '</address>';
echo "<a href=".$row['website'].">
<h5>Official Website</h5></a>";?>
?>
<span onclick='BusinessAdd("<?php echo
$row['BusinessAddress']; ?>")' type="button" data-
toggle="modal" data-target="#Business-Signup" data-
backdrop="static" data-keyboard="false"> Business
Information</span>
</div>
</div>
</div>
</div>
<?php
}
?>
<button onclick="topFunction()" id="myBtn" title="Go to
top">Top</button>
</div>
</div>
<!-- *********** fill out Business information ********************* -->
<form id="BusinessInformation" > <!-- action="" method="post" -->
<div class="modal animate fade" id="Business-Signup" role="dialog"
aria-labelledby="CenterTitle" aria-hidden="true">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="CenterTitle">
<strong>Business Information:</strong></h5>
<div class="SiteViews">
<label style="color: #0f4471;" class="buslabel"
for="Views">Views: </label>
</div>
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span style="margin-right: 25px;" aria-
hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="CompanyInfo">
<ul>
<li>
<br /><label class="buslabel" for="Name">Business Name:
<strong><input id="BusName" value="<?php echo
$row['BusinessName']; ?>" type="text" tabindex="1"
class="businput search" placeholder="Business Name"
size="30" name="Business Name" max="30" required>
</strong>
</label>
Need to be able to click on the button [on back of the card] and open another modal to display data from mysql database about that card.
Need to somehow link the card so that it is associated with the item in the database for that particular card.
when i include a agenda.php file that contains a div with bootstrap modal class inside a div in another php file, it doesn't show properly.
agenda.php
<style type="text/css">
.block a:hover{
color: silver;
}
.block a{
color: #fff;
}
.block {
position: fixed;
background: #2184cd;
padding: 20px;
z-index: 1;
top: 240px;
}
</style>
<!-- Place this tag where you want the badge to render. -->
<br /><br />
<hr />
<!--<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js" crossorigin="anonymous"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" >
-->
<!-- add calander in this div -->
<div class="container">
<div class="row">
<div id="calendar"></div>
</div>
</div>
<!-- Modal -->
<div id="createEventModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add Event</h4>
</div>
<div class="modal-body">
<div class="control-group">
<label class="control-label" for="inputPatient">Event:</label>
<div class="field desc">
<input class="form-control" id="title" name="title" placeholder="Event" type="text" value="">
</div>
</div>
<input type="hidden" id="startTime"/>
<input type="hidden" id="endTime"/>
<div class="control-group">
<label class="control-label" for="when">When:</label>
<div class="controls controls-row" id="when" style="margin-top:5px;">
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button type="submit" class="btn btn-primary" id="submitButton">Save</button>
</div>
</div>
</div>
</div>
<div id="calendarModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Event Details</h4>
</div>
<div id="modalBody" class="modal-body">
<h4 id="modalTitle" class="modal-title"></h4>
<div id="modalWhen" style="margin-top:5px;"></div>
</div>
<input type="hidden" id="eventID"/>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button type="submit" class="btn btn-danger" id="deleteButton">Delete</button>
</div>
</div>
</div>
</div>
<!--Modal-->
<div style='margin-left: auto;margin-right: auto;text-align: center;'>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-21769945-4', 'auto');
ga('send', 'pageview');
</script>
<div>
<h1> La fin ya scampo </h1>
</div>
</div>
index.php
...
...
<div class="tab-pane fade" id="Agenda">
<?php include("agenda.php"); ?>
</div>
...
...
i expect the code to show a calendar in a part of my index.php.
PS: when i delete the modal class from the div tag it works all fine, i know that the modal should be in the top, but aren't there any other method?
The PHP include file is not the problem. There is no reason why you cannot have the Bootstrap modal in a PHP include file. The include file is injected into the HTML code before the DOM is rendered, so there should be no problem.
HOWEVER... Possibly, the problem is having the Bootstrap modal dialog structure be added to the HTML inside another div -
<div class="tab-pane fade" id="Agenda">
<?php include("agenda.php"); ?>
</div>
The Bootstrap modal should be at the first level under the body tag. That is where Bootstrap expects it to be. Doing that should not be a problem, since the Bootstrap modal is invisible until displayed... Resist the temptation to add additional layers of HTML outer containers to the Bootstrap divs until you are really sure you understand Bootstrap scaffolding.
Also, having the fade tag on that same #Agenda div (the one that the modal dialog is in) might not be a good idea. Note that you do not need the modal inside the #Agenda div in order to use it for an agenda (calendar?) functionality.
I suggest that until you solve your problem, get rid of all the include files. Take the code in your PHP include files and stick it into the main body, so that you only have the one index.php file, with no includes. Once you get it working, you can then break things out into the include files. Simplify to solve.
So, i am using a bootstrap modal, and inside of the modal, i want to use image upload, but when an image is selected, nothing happens, i am asuming it is a javascript issue, the script and the css is included outside of the modal in the header.
http://jasny.github.com/bootstrap/javascript.html#fileupload
Any suggestions? I asume it is a javascript issue
<?php
if (isset($_SESSION['login']) and !empty($_SESSION['login']) and $_SESSION['rank'] == 3) {
echo '
<!-- Modal -->
<div id="insert_post_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Insert Post</h3>
</div>
<div class="modal-body">
<p>
<form action="insert_post_sql" method="post" enctype="multipart/form-data">
<table border="0">
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="fileupload-new thumbnail" style="width: 200px; height: 150px;"><img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&text=no+image" />
</div>
<div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;">
</div>
<div>
<span class="btn btn-file"><span class="fileupload-new">Select image</span>
<span class="fileupload-exists">Change</span><input type="file" /></span>
Remove
</div>
</div>
</table>
</form>
</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<input type="submit" button class="btn btn-primary" value="Submit Post">
</div>
</div>
</form>
';
}
?>
Try to use Document Ready function because the Script is loaded prior to the Modal HTML
$('document').ready(function(){
$('#insert_post_modal').on('shown', function(){
$('.fileupload').fileupload();
});
});
Try calling the fileupload on modal shown (i.e. when the user opens it):
$('#insert_post_modal').on('shown', function(){
$('.fileupload').fileupload();
});
Can't test it right now though, I'm sorry
$(document).ready(function(){
$image_crop = $('#image_demo').croppie({
enableExif: true,
viewport: {
width:300,
height:300,
type:'square' //circle
},
boundary:{
width:400,
height:400
}
});