gpt4 book ai didi

html - 如何将模式附加到按钮或图像?我的代码无法正常工作...我看到了按钮,但模式无法打开

转载 作者:太空宇宙 更新时间:2023-11-04 10:05:20 24 4
gpt4 key购买 nike

我在代码底部添加的模式需要帮助。不确定我是否附错了它们,或者模态代码本身是否错误。请帮忙!!!

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Jane Doette</title>
<script type="text/javascript" href="jquery-3.0.0.js"></script>
<script type="text/javascript" href="bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap.css">
<link rel="stylesheet" type="text/css" href="JaneDoette.css">
<link href='https://fonts.googleapis.com/css?family=Lato:300'
rel='stylesheet' type='text/css'>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-6">
<img class="title-logo"
src="file:///Users/Diana/Documents/fvlogo.gif" class="img-responsive"
alt="responsive image">
</div>
<div class="col-md-6 text-right text-uppercase">
<h1 class="title-super text-thin">Jane Doette</h1>
<h3>Front-end Ninja</h3>
</div>
</div>
<div class="row">
<div class="col-md-12">
<img
src="file:///Users/Diana/Documents/testhtml1140x350.jpg" class="img-
responsive" alt="responsive image">
</div>
</div>
<div class="row">
<div class="col-md-12">
<h2 class="text-muted">Featured Work</h2>
</div>
</div>
<div class="row text-center">
<div class="col-md-4">
<img src="file:///Users/Diana/Documents/450x300Type.jpg"
class="img-responsive" alt="responsive image">
<h3>Type</h3>
<p>
<button type="button" class="btn" data-toggle="modal"
data-target="#project1">Launch Demo Modal</button>
</p>
</div>
<div class="col-md-4">
<img
src="file:///Users/Diana/Documents/450x300wallpaper.jpg"
class="img-responsive" class="img-responsive"
alt="responsive image">
<h3>Wallpaper</h3>
<p>
<button type="button" class="btn" data-toggle="modal"
data-target="#project1">Launch Demo Modal</button>
</p>
</div>
<div class="col-md-4">
<img src="file:///Users/Diana/Documents/450x300print.jpg"
class="img-responsive" class="img-responsive"
alt="responsive image">
<h3>Print</h3>
<p>
<a href="http://github.com">Link to project</a>
</p>
</div>
</div>
</div>

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-
target="#project1">
</button>

<!-- Modal1 -->
<div class="modal fade" id="project1" tabindex="-1" role="dialog" aria-
labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true"></span><span class="sr-
only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Type</h4>
</div>
<div class="modal-body">
<img src="file:///Users/Diana/Documents/450x300Type.jpg"
class="img-responsive" alt="responsive image">
<p> This was my first project in this class. I learned a
lot about HTML and CSS. The portfolio page looks nice,
but there really isn't that much info about your
projects. but putting a lot of text under the image
wouldn't look nice. So adding a modal would be the best
way to do this. </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save Changes
</button>
</div>
</div>
</div>
</div>

<!--Modal2-->
<div class="modal fade" id="project1" tabindex="-1" role="dialog" aria-
labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true"></span><span class="sr-
only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Type</h4>
</div>
<div class="modal-body">
<img
src="file:///Users/Diana/Documents/450x300Wallpaper.jpg"
class="img-responsive" alt="responsive image">
<p> This was my first project in this class. I learned a
lot about HTML and CSS. The portfolio page looks nice,
but there really isn't that much info about your
projects. but putting a lot of text under the image
wouldn't look nice. So adding a modal would be the best
way to do this. </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save Changes
</button>
</div>
</div>
</div>
</div>

<!--Modal3-->
<div class="modal fade" id="project1" tabindex="-1" role="dialog" aria-
labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true"></span><span class="sr-
only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Type</h4>
</div>
<div class="modal-body">
<img src="file:///Users/Diana/Documents/450x300Print.jpg"
class="img-responsive" alt="responsive image">
<p> This was my first project in this class. I learned a
lot about HTML and CSS. The portfolio page looks nice,
but there really isn't that much info about your
projects. but putting a lot of text under the image
wouldn't look nice. So adding a modal would be the best
way to do this. </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save Changes
</button>
</div>
</div>
</div>
</div>
</body>
</html>

我需要一个按钮或图像附加到模式,我已经尝试过两者,但似乎都不起作用。

最佳答案

很难理解“将按钮附加到模式”的意思,因为我能够在 JSFiddle 中打开模式,但是我在您的标记中发现了一些错误,我相信这些错误可能会对您有所帮助:

  • 您似乎想要在页面上使用三个独立的模态框。但是,这些模式中的每一个都具有相同的 id 属性(它们都是 project1)。 ID 必须是唯一的。
  • 一旦所有 id 属性都是唯一的,将按钮元素上的 data-target 属性更改为它对应的模态的 id
  • 不确定您是否忘记复制整个内容,但是您的 doctype 声明不完整。

Here's a fixed version

关于html - 如何将模式附加到按钮或图像?我的代码无法正常工作...我看到了按钮,但模式无法打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38045648/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com