我是编程的初学者.我一直在寻找答案,但我找到的所有答案都没有解决我的问题.我使用了如何中心javascript css popup div,无论屏幕分辨率如何?问题中解释了弹出div方法.
是否可以通过点击外部来关闭div,只需对以下代码进行少量更改?
<script type="text/javascript">
function showPopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "block"
dlg.style.display = "block"
if (document.body.style.overflow = "scroll") {
cvr.style.width = "1024"
cvr.style.height = "100%"
}
}
function closePopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "none"
dlg.style.display = "none"
document.body.style.overflowY = "scroll"
}
</script>
<style type="text/css">
#cover {
display: none;
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
background: gray;
filter: …
Run Code Online (Sandbox Code Playgroud) 所以,我一直试图像Angular Accordion那样制作动画,但没有成功.我认为它具有固定的高度,但不是动态的.身高:自动; 不起作用.:(
也许你们有些人遇到过类似的问题?
我的代码:
HTML:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-route.js"></script>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<section ng-app="myApp">
<div ng-controller="myCtrl as vm">
<ul ng-init="vm.tab=1">
<li ng-repeat="item in vm.data">
<a href ng-click="vm.tab = item.thingy">{{item.name}}</a>
<div ng-show="vm.tab === item.thingy">
<img ng-src="{{item.img}}" width="50px"><br>
<div class="longDiv">{{item.description}}</div>
</div>
</li>
</ul>
</div>
</section>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
JS:
var app = angular.module('myApp', []);
app.controller('myCtrl', ['$scope',
function($scope) {
var vm = this;
vm.data = [{
name: "First",
title: "oneTitle",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing …
Run Code Online (Sandbox Code Playgroud) 我有一些麻烦,了解如何动态组合简单的一个语言网站.如果有人能用婴儿语言向我解释下面代码的每个部分是什么意思,我真的很感激:
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(php|css|js|gif|png|jpe?g|pdf)$
RewriteRule (.*)$ templates/index.php [L]
Run Code Online (Sandbox Code Playgroud)
先感谢您!
之前我问过这个问题,并且想知道也许有人有类似的问题,也许知道如何处理它?我的plnkr!
Angular标签不适用于ng-repeat.似乎Angular无法将来自ng-show的点击和标签值的标签值放在一起.我的代码:
<section ng-app="myApp">
<div ng-controller="myCtrl">
<ul ng-init="tab=1">
<li ng-repeat="item in data">
<a href ng-click="tab = item.thingy">{{item.name}}</a>
</li>
</ul>
<div ng-repeat="item in data" ng-show="tab === item.thingy">
<img ng-src="{{item.img}}" width="50px"><br>
{{item.year}}</div>
</div>
</section>
Run Code Online (Sandbox Code Playgroud)
var app = angular.module('myApp', []);
app.controller('myCtrl', ['$scope', function($scope) {
$scope.data = [{
name: "First",
title: "oneTitle",
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
year: "2013",
img: "http://static.hdw.eweb4.com/media/wp_400/1/5/42735.jpg",
thingy: 1
}, {
name: "third",
title: "twoTitle",
description: "Quisque pulvinar libero sed eros …
Run Code Online (Sandbox Code Playgroud) 所以,我正在做一个标签布局.鼠标悬停时标签越来越大,鼠标输出标签越来越小,我在每个标签中都有一个链接,打开div.问题是,当我将鼠标放在此链接上时,选项卡会变小,因为鼠标会离开此选项卡.所以,我的问题是 - 如何将这两者结合在一起,以便只有当鼠标实际离开那个区域时,它才能更加平滑和穿着?
这是我的代码:
<script>
$(document).ready(function(){
$('.slice').mouseenter(function(){
var $this = $(this);
$this.data('widthA', $this.css('width')).stop().animate({'width': '250px'}, 400);
}).mouseout(function(){
var $this = $(this);
$this.stop().animate({'width': $this.data('widthA')}, 200);
});
$(".tabLink").click(function(){
$('.projectTab').hide();
$('#'+$(this).attr('name')).show();
});
});
</script>
<style>
.slice { color: gray; width: 1%; }
li { background: yellow; }
.sliceWrap { margin: 0; height: 70px; padding: 0px; display: table; width: 100%; }
.sliceWrap ul { margin: 0; height: 70px; padding: 0px; display: table; background: #ccc; width: 100%; }
.sliceWrap li { list-style: none; padding: 0px; width: …
Run Code Online (Sandbox Code Playgroud)