- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试改编 UI app由 codepen 用户 Fabio Ottaviani 构建,采用它的基本功能并将其放置在 Bootstrap 模式中。如果将它从模态中移除,它工作正常,但当放置在模态中时,它第一次工作,然后在重置后中断。重置 UI 后,courser 甚至不会变成指针/手。
var $play = $('.play'),
$detail = $('.detail'),
$movie = $('.movie', $detail),
$close = $('.close');
$('.movies .movie').click(function(){
$movie.html($(this).html());
$play.appendTo($movie);
$poster = $('.poster', this).addClass('active');
$('.poster', $detail).css({
top: $poster.position().top,
left: $poster.position().left,
width: $poster.width(),
height: $poster.height()
}).data({
top: $poster.position().top,
left: $poster.position().left,
width: $poster.width(),
height: $poster.height()
})
$detail.show();
$('.poster', $detail).delay(10).queue(function(next) {
$detail.addClass('ready');
next();
}).delay(100).queue(function(next){
$(this).css({
top: '-10%',
left: '-6%',
width: 266,
height: 400
});
next();
})
})
/*--------------------
Close
--------------------*/
function close(){
console.log('asd');
$p = $('.detail .poster');
console.log($p)
$p.css({
top: $p.data('top'),
left: $p.data('left'),
width: $p.data('width'),
height: $p.data('height'),
})
$detail.removeClass('ready').delay(500).queue(function(next){
$(this).hide();
$poster.removeClass('active');
next();
});
}
$close.click(close);
$('body').click(function(e){
$p = $(e.target).parents();
if ($p.is('.app')){
return false;
} else {
close();
}
})
/***********reset.css************/
div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,svg,symbol,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,output,ruby,section,summary,time,mark,audio,video {
margin:0;
padding:0;
border:0;
font-size:100%;
font:inherit;
vertical-align:baseline;
}
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{
display:block;
}
body {line-height:1;
}
ol,ul {
list-style:none
}
blockquote,q{
quotes:none;
}
blockquote:before,blockquote:after,q:before,q:after{
content:''; content:none;
}
table{
border-collapse:collapse;
border-spacing:0;
}
/************style.css************/
/*--------------------
App
--------------------*/
.app h2 {
color: #525661;
font-size: 17px;
box-shadow: inset 0 1px 0px rgba(0, 0, 0, 0.1);
padding: 20px 28px 0;
margin: -6px 0 0 0;
}
/*--------------------
Movies
--------------------*/
.movies {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
padding: 8px 18px;
}
.movies .movie {
padding: 10px;
cursor: pointer;
}
.movies .movie .poster {
width: 100%;
margin-bottom: 6px;
border-radius: 4px;
}
.movies .movie .poster.active {
opacity: 0;
}
.movies .movie .title {
color: #525661;
margin-bottom: 4px;
font-size: 16px;
}
.movies .movie .info {
font-size: 11px;
opacity: .8;
}
.movies .movie .desc {
display: none;
}
/*--------------------
Detail
--------------------*/
.detail {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
padding: 37px 30px 30px 255px;
display: none;
}
.detail::before {
content: '';
background: #fff;
position: absolute;
z-index: -1;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 15px;
opacity: 0;
-webkit-transition: all 0.4s cubic-bezier(0.67, 0.13, 0.1, 0.81);
transition: all 0.4s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .close {
position: absolute;
top: 21px;
right: 22px;
width: 12px;
height: 12px;
cursor: pointer;
border: 6px solid #FFF;
box-sizing: content-box;
z-index: 10;
}
.detail .poster {
position: absolute;
z-index: 2;
top: -10%;
left: -6%;
height: 100%;
border-radius: 5px;
box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
-webkit-transition: all 0.5s cubic-bezier(0.67, 0.13, 0.1, 0.81);
transition: all 0.5s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .title,
.detail .info,
.detail .desc,
.detail .play,
.detail .close {
-webkit-transform: translateX(-50px);
transform: translateX(-50px);
opacity: 0;
-webkit-transition: all 0.4s cubic-bezier(0.67, 0.13, 0.1, 0.81);
transition: all 0.4s cubic-bezier(0.67, 0.13, 0.1, 0.81);
}
.detail .close {
-webkit-transform: translateX(10px);
transform: translateX(10px);
}
.detail .title {
font-size: 35px;
font-weight: 300;
color: #525661;
margin-bottom: 5px;
}
.detail .info {
font-size: 11px;
opacity: 0;
margin-left: 2px;
}
.detail .desc {
margin-top: 30px;
font-size: 14px;
line-height: 1.6;
}
.detail .play {
background: -webkit-linear-gradient(0deg, #E4761F, #FF8B32);
background: linear-gradient(90deg, #E4761F, #FF8B32);
border: none;
border-radius: 20px;
color: #fff;
font-size: 12px;
line-height: 1.5;
padding: 8px 17px;
margin: 30px 0 0 -2px;
text-transform: uppercase;
z-index: 10;
outline: none !important;
cursor: pointer;
opacity: 0;
}
.detail .play svg {
vertical-align: middle;
position: relative;
top: -2px;
margin-right: 3px;
}
.detail.ready::before {
opacity: 1;
}
.detail.ready .info {
opacity: .8;
}
.detail.ready .poster {
opacity: 1;
-webkit-transition-duration: .5s;
transition-duration: .5s;
}
.detail.ready .title,
.detail.ready .info,
.detail.ready .desc,
.detail.ready .play,
.detail.ready .close {
-webkit-transform: translateX(0);
transform: translateX(0);
opacity: 1;
-webkit-transition-delay: 0s;
transition-delay: 0s;
-webkit-transition-duration: .5s;
transition-duration: .5s;
}
.detail.ready .title {
-webkit-transition-delay: .2s;
transition-delay: .2s;
}
.detail.ready .info {
-webkit-transition-delay: .3s;
transition-delay: .3s;
}
.detail.ready .desc {
-webkit-transition-delay: .4s;
transition-delay: .4s;
}
.detail.ready .play {
-webkit-transition-delay: .5s;
transition-delay: .5s;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Portfolio</title>
<!--modal-->
<script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script>
<link rel="stylesheet prefetch" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">
<style>
/* NOTE: The styles were added inline because Prefixfree needs access to the styles and they must be inlined if they are on local disk! */
.modal-open body {
-webkit-filter: blur(1px);
-moz-filter: blur(1px);
filter: blur(1px);
}
.modal-dialog .modal-content {
border-radius: 0;
box-shadow: none;
background-color: rgba(255, 255, 255, 0.9);
padding-left: 30px;
padding-right: 30px;
}
.modal-backdrop {
background-color: rgba(255, 255, 255, 0.6);
}
.columns {
column-count: 3;
column-gap: 20px;
}
img {
width: 100%;
cursor: pointer;
}
</style>
<script src="js/prefixfree.min.js"></script>
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet prefetch" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<a href="#" data-toggle="modal" data-target="#modal">Open Modal</a>
<div class="modal fade" id="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="app">
<legend>Most Popular Movies</legend>
<section class="movies">
<div class="movie">
<img src="http://movium.io/data/posters/eqFckcHuFCT1FrzLOAvXBb4jHwq.jpg" alt="" class="poster" />
<div class="title">Room</div>
<div class="info">
<span class="length">117 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
Jack is a young boy of 5 years old who has lived all his life in one room. He believes everything within it are the only real things in the world. But what will happen when his Ma suddenly tells him that there are other things outside of Room?
</div>
</div>
<div class="movie">
<img src="http://movium.io/data/posters/lIv1QinFqz4dlp5U4lQ6HaiskOZ.jpg" alt="" class="poster" />
<div class="title">Whiplash</div>
<div class="info">
<span class="length">167 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
Under the direction of a ruthless instructor, a talented young drummer begins to pursue perfection at any cost, even his humanity.
</div>
</div>
<div class="movie">
<img src="http://movium.io/data/posters/kqjL17yufvn9OVLyXYpvtyrFfak.jpg" alt="" class="poster" />
<div class="title">Mad Max</div>
<div class="info">
<span class="length">120 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
An apocalyptic story set in the furthest reaches of our planet, in a stark desert landscape where humanity is broken, and most everyone is crazed fighting for the necessities of life. Within this world exist two rebels on the run who just might be able to restore order. There's Max, a man of action and a man of few words, who seeks peace of mind following the loss of his wife and child in the aftermath of the chaos.
</div>
</div>
<div class="movie">
<img src="http://movium.io/data/posters/5W794ugjRwYx6IdFp1bXJqqMWRg.jpg" alt="" class="poster" />
<div class="title">The Revenant</div>
<div class="info">
<span class="length">156 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
In the 1820s, a frontiersman, Hugh Glass, sets out on a path of vengeance against those who left him for dead after a bear mauling.
</div>
</div>
</section>
<div class="detail">
<svg class="close">
<use xlink:href="#close"></use>
</svg>
<div class="movie">
<img src="http://movium.io/data/posters/eqFckcHuFCT1FrzLOAvXBb4jHwq.jpg" alt="" class="poster" />
<div class="title">Room</div>
<div class="info">
<span class="length">117 min</span>
<span class="year">2015</span>
</div>
<div class="desc">
Jack is a young boy of 5 years old who has lived all his life in one room. He believes everything within it are the only real things in the world. But what will happen when his Ma suddenly tells him that there are other things outside of Room?
</div>
<button class="play">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewbox="0 0 232.153 232.153" style="enable-background:new 0 0 232.153 232.153;" xml:space="preserve" width="10px" height="10px">
<g id="Play">
<path style="fill-rule:evenodd;clip-rule:evenodd;" d="M203.791,99.628L49.307,2.294c-4.567-2.719-10.238-2.266-14.521-2.266 c-17.132,0-17.056,13.227-17.056,16.578v198.94c0,2.833-0.075,16.579,17.056,16.579c4.283,0,9.955,0.451,14.521-2.267 l154.483-97.333c12.68-7.545,10.489-16.449,10.489-16.449S216.471,107.172,203.791,99.628z" fill="#FFFFFF" />
</g>
</svg> play movie
</button>
</div>
</div>
</div>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- Icons -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none;">
<symbol id="close" viewbox="0 0 212.982 212.982">
<g>
<path style="fill-rule:evenodd;clip-rule:evenodd;" d="M131.804,106.491l75.936-75.936c6.99-6.99,6.99-18.323,0-25.312 c-6.99-6.99-18.322-6.99-25.312,0l-75.937,75.937L30.554,5.242c-6.99-6.99-18.322-6.99-25.312,0c-6.989,6.99-6.989,18.323,0,25.312 l75.937,75.936L5.242,182.427c-6.989,6.99-6.989,18.323,0,25.312c6.99,6.99,18.322,6.99,25.312,0l75.937-75.937l75.937,75.937 c6.989,6.99,18.322,6.99,25.312,0c6.99-6.99,6.99-18.322,0-25.312L131.804,106.491z" fill="#525661" />
</g>
</symbol>
<symbol id="ico-search">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#363a47" d="M14.769,14.769c-0.342,0.342-0.896,0.342-1.237,0l-3.756-3.756
c-2.399,1.793-5.801,1.623-7.981-0.557c-2.392-2.392-2.392-6.271,0-8.663s6.271-2.392,8.662,0c2.18,2.181,2.35,5.583,0.557,7.981
l3.756,3.756C15.11,13.873,15.11,14.427,14.769,14.769z M9.219,3.032c-1.709-1.709-4.479-1.709-6.188,0
c-1.708,1.708-1.708,4.479,0,6.188c1.709,1.708,4.479,1.708,6.188,0C10.927,7.51,10.927,4.74,9.219,3.032z" />
</symbol>
</svg>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script src="js/index.js"></script>
</body>
</html>
最佳答案
您遇到范围界定问题。查看应用程序的控制台日志时,我注意到错误
$poster 未定义
在查看您的代码时,我看到 $poster 被设置为某些内容,但范围限于 $('.movies .movie')
点击功能。该功能之外的所有需要使用它的东西都不知道它是什么。
解决这个问题的方法是将 $poster
添加到顶部的全局变量
var $play = $('.play'),
$细节= $('.细节'),
$movie = $('.movie', $detail),
$close = $('.close'),
$海报;
关于javascript - 为什么我的 UI 应用嵌套在 Bootstrap 模式中时无法运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36684547/
对此感到疯狂,真的缺少一些东西。 我有webpack 4.6.0,webpack-cli ^ 2.1.2,所以是最新的。 在文档(https://webpack.js.org/concepts/mod
object Host "os.google.com" { import "windows" address = "linux.google.com" groups = ["linux"] } obj
每当我安装我的应用程序时,我都可以将数据库从 Assets 文件夹复制到 /data/data/packagename/databases/ .到此为止,应用程序工作得很好。 但 10 或 15 秒后
我在 cc 模式缓冲区中使用 hideshow.el 来折叠我不查看的文件部分。 如果能够在 XML 文档中做到这一点就好了。我使用 emacs 22.2.1 和内置的 sgml-mode 进行 xm
已结束。此问题不符合 Stack Overflow guidelines .它目前不接受答案。 我们不允许提出有关书籍、工具、软件库等方面的建议的问题。您可以编辑问题,以便用事实和引用来回答它。 关闭
根据java: public Scanner useDelimiter(String pattern) Sets this scanner's delimiting pattern to a patt
我读过一些关于 PRG 模式以及它如何防止用户重新提交表单的文章。比如this post有一张不错的图: 我能理解为什么在收到 2xx 后用户刷新页面时不会发生表单提交。但我仍然想知道: (1) 如果
看看下面的图片,您可能会清楚地看到这一点。 那么如何在带有其他一些 View 的简单屏幕中实现没有任何弹出/对话框/模式的微调器日期选择器? 我在整个网络上进行了谷歌搜索,但没有找到与之相关的任何合适
我不知道该怎么做,我一直遇到问题。 以下是代码: rows = int(input()) for i in range(1,rows): for j in range(1,i+1):
我想为重写创建一个正则表达式。 将所有请求重写为 index.php(不需要匹配),它不是以/api 开头,或者不是以('.html',或'.js'或'.css'或'.png'结束) 我的例子还是这样
MVC模式代表 Model-View-Controller(模型-视图-控制器) 模式 MVC模式用于应用程序的分层开发 Model(模型) - 模型代表一个存取数据的对象或 JAVA PO
我想为组织模式创建一个 RDF 模式世界。您可能知道,组织模式文档基于层次结构大纲,其中标题是主要的分组实体。 * March auxiliary :PROPERTIES: :HLEVEL: 1 :E
我正在编写一个可以从文件中读取 JSON 数据的软件。该文件包含“person”——一个值为对象数组的对象。我打算使用 JSON 模式验证库来验证内容,而不是自己编写代码。符合代表以下数据的 JSON
假设我有 4 张 table 人 公司 团体 和 账单 现在bills/persons和bills/companys和bills/groups之间是多对多的关系。 我看到了 4 种可能的 sql 模式
假设您有这样的文档: doc1: id:1 text: ... references: Journal1, 2013, pag 123 references: Journal2, 2014,
我有这个架构。它检查评论,目前工作正常。 var schema = { id: '', type: 'object', additionalProperties: false, pro
这可能很简单,但有人可以解释为什么以下模式匹配不明智吗?它说其他规则,例如1, 0, _ 永远不会匹配。 let matchTest(n : int) = let ran = new Rand
我有以下选择序列作为 XML 模式的一部分。理想情况下,我想要一个序列: 来自 my:namespace 的元素必须严格解析。 来自任何其他命名空间的元素,不包括 ##targetNamespace和
我希望编写一个 json 模式来涵盖这个(简化的)示例 { "errorMessage": "", "nbRunningQueries": 0, "isError": Fals
首先,我是 f# 的新手,所以也许答案很明显,但我没有看到。所以我有一些带有 id 和值的元组。我知道我正在寻找的 id,我想从我传入的三个元组中选择正确的元组。我打算用两个 match 语句来做到这
我是一名优秀的程序员,十分优秀!