我目前有一些问题让我的页脚保持在页面底部和内容下方.我目前把它放在页面的底部,只是将它保持在内容下面似乎是问题.
我的页脚布局是:
#footer
#footer-content
p.copyright
p.credit
/#footer-content
/#footer
Run Code Online (Sandbox Code Playgroud)
我的样式表:
#footer {
overflow: hidden;
clear: both;
max-width: 940px;
padding-top: 26px;
border-top: 1px solid #bbb;
color: #aaa;
position: fixed;
height: 80px;
width: 50%;
bottom: 0;
right: 0;
left: 0;
margin: 0 auto;
padding-bottom: 0;
text-align: center;
}
#footer-content {
width: 100%;
}
Run Code Online (Sandbox Code Playgroud)
将位置设置为绝对会使整个页脚在页面的某个位置消失,所以我不能只改变它.
我可以做些什么来保持我的页脚低于内容?我对任何JavaScript解决方案都持开放态度.
FIDDLE(因为它是WordPress我无法复制所有内容)
编辑:
做了一些编辑.仍然没有改变我的问题.
我试图为类中的每个对象生成一个新的唯一标识符,而不使用static nextID字段来递增。使用它会在卸载和卸载程序时产生复杂性。
我想出了一个解决方案,以静态方法循环遍历所有对象,检查所有对象,但由于某些我未知的原因,它不会退出 while 循环。
我一直在 ideone.com 上对其进行测试,尝试从一开始就创建 5 个对象,但它甚至不会创建一个。
无需访问链接即可查看整个测试代码,下面是我正在使用的方法。
public static int newRandomID() {
int randomID = 0;
boolean notUnique = true;
while (notUnique) {
randomID = (int) (Math.random() * 999999 + 1);
for (Example e : examples) {
if (e.ID == randomID) {
notUnique = true;
break;
}
notUnique = false;
}
}
return randomID;
}
Run Code Online (Sandbox Code Playgroud)
我是否刚刚犯了一个愚蠢的错误,我太盲目而看不到,或者有什么原因导致这不起作用?
对于ES6类,我们有getter和setter属性,但没有字段选项(或者至少我知道).
使用Object.defineProperty,您可以使用value属性设置它们.如果有的话,你如何对课程做同样的事情?
我知道它可以在类构造函数中完成,但是如果可能的话我希望它是分开的.
我在我正在进行的一个项目中使用 bx-slider,最近发现它创建第一个和最后一个输入元素的克隆,将它们放置在各自的位置,从而为滑块提供“无限”效果。
这很棒,但是当我在最后一个标签中使用标签时,它不起作用,因为两个标签上的 for 属性将获得第一个输入,分别是克隆。
有什么方法可以在 for 属性中使用 jQuery/CSS 选择器吗?(例子:<label for="isActive28:last">)
由于请求,这里有一个快速的 jsfiddle 来展示我的意思: http: //jsfiddle.net/YG9u9/1/
I'm using PHP to display an image (dynamically returning a binary blob with a mime type of image/png for example) so that means I can't use the typical method for changing the favicon (link tags).
The HTML solution is this:
<link rel="shortcut icon" href="favicon.ico" />
Run Code Online (Sandbox Code Playgroud)
Is there a way I can set the favicon in PHP for a non HTML document?
我目前正在做一些造型,并想出了一种有趣的方式来做某事。我想创建一段文本,在页面上的所有其他文本中脱颖而出。下面你可以看到我这样做的方式。
var el = document.querySelectorAll('span[class^=impact]')[0],
col = el.className.split('-')[1];
el.style.textShadow = '2px 2px 0 #' + col;Run Code Online (Sandbox Code Playgroud)
html, body {
width: 100%;
height: 100%;
margin: 0;
background-image: url('http://i.imgur.com/UxB7TDq.jpg');
}
[class^=impact] {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
font-family: Impact, sans-serif;
font-size: 72pt;
font-weight: 800;
text-transform: uppercase;
}Run Code Online (Sandbox Code Playgroud)
<span class="impact-008080">impact</span>Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我基本上是获取类的前半部分并对其应用样式,然后在 JavaScript 中获取类的后半部分并应用阴影。我想要做的是完全省略 JavaScript 并将其全部保留在 CSS 中。
我没有颜色清单。显然支持任何和所有十六进制颜色。我宁愿保留这种格式。
所以我试图通过值来获取对象键,以节省必须使用反向键和值创建重复对象的时间.
无论是从值返回键的函数还是我错过了内置方法,我都不在乎.我只需要一种方法来获取密钥.
例:
var user = {'name':'john', 'age':26, 'gender':'male'}
getKey(user.male) // Would return 'gender'?
Run Code Online (Sandbox Code Playgroud)
有没有简单的方法来获得它或需要一个功能?