div

DIV background-image overflow

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a DIV element with a background-image, and I want it to overflow outside the dimensions of the DIV (it now cuts off the image because the image is bigger than the DIV). Is this possible? overflow:visible doesn't work! 回答1: You can do it in alternative way: #box { margin:-50px 0 0; padding:50px 0 0 0; background:url(/images/image.png) no-repeat; } 回答2: Put the background on a larger <div> that contains your <div> . 回答3: It is very possible with CSS3. I stumbled on this post while attempting this myself and discovered I could do it.

jQuery toggle div from select option

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm in need to toggle divs from a dropdown select option box. I'd like it similar to asmselect for jquery but instead of listing the option tag I'd like it to display a hidden div. Is there anything like this out there? Or anyone know how to set it up? Thanks, Jeff. UPDATED Basically what I want is the look and interaction of the asmselect link above though toggling divs instead of generating a list. Example code below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1

Show only open div with angular if

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to acheive the same behavior as the spring code below: <c:forEach items="${data}" var="data" varStatus="contador"> <c:if test="${(contador.count-1)%3==0}"> <div class="conjunto-${conjunto} row"> <!-- Show opening div --> </c:if> <!-- Some HTML goes here --> <c:if test="${((contador.count-1)%3==2)}"> </div> </c:if> </c:forEach> Explaining: I want a new div from class row only after 3 other HTML elements have been added. I have tried this with ng-if , like this: <div ng-repeat="data in DATA"> <div class="conjunto-{{$index/3}} row"

How to scroll a scrollable div when scrolled on other, non-scrollable div?

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I know the question sounds confusing, but here is what I am trying to do - in the snippet below, if the user scrolls on the green div, I want the yellow div to be scrolled accordingly, just as if the yellow div was scrolled. Note that the yellow div has overflow: auto; but the green one doesnt. document . getElementById ( 'green' ). addEventListener ( 'wheel' , function ( e ){ console . log ( 'scrolled!' ); console . log ( e . deltaX ); // it is always "-0" // scroll div#yellow accordingly }); #yellow{ background - color : yellow ;

Multiline string in div using javascript

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have created a multiline string as follows" var str1 = document . getElementById ( 'text1' ); var str2 = document . getElementById ( 'text2' ); var str = str1 . value + "\n" + str2 . value ; I now want to add this string to a div that I create in a popup window as follows: myWindow = window . open ( '' , 'Full_text' , 'width=600,height=600' ); myWindow . document . write ( '<div id="div1" style="position: absolute; left: 10px; width: 580px; top: 30px; height: 550px; overflow: auto;">' + str + '</div>' ); But I do not get a

Create and download pdf from div on angular 2

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to create and download an PDF from an existing div with jsPDF. I have tried many ways but I can't achieve it. My last try was with @ViewChild and ElementRef but doesn't work to. detail-devis.component.ts: import {Component, ElementRef, ViewChild} from "angular2/core"; declare let jsPDF; @Component({ selector: 'my-app', template: `<div #test> Hello world </div> <button type="button" (click)="test()">pdf</button> <button (click)="download()">download</button>` }) export class App { @ViewChild('test') el: ElementRef; constructor() {

Expand div from center of viewport

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a question before wherein I wanted to expand a div from the center of the body . It works fine not until I encountered this scenario wherein the content of the body is long enough that a scroll bar now shows. Notice on this jsFiddle that when I scroll to a little to the bottom or just halfway then clicked anywhere on the page, the expanded div is displayed at the very top of the page. I know this CSS code below has something to do with it: . growme { background - color : #990000; height : 0 ; width : 0 ; position : absolute

d3js append div

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I tried to add some popup messages next to the node but it looks like anything else then text svg and image cant be displayed with append. node.append("text") .attr("dx", 16) .attr("dy", ".0em") .text(function(d) { return d.name }); works and adds the text but i tried to add a div and its not visible, node.append("div"). Is there something i am missing here? also how can i easly get the position of node so i can transfer the attributes to another element. 回答1: You can't put HTML elements anywhere in an SVG, you need to enclose them in a

Auto Scroll to Bottom DIV

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have made chat system, but I had a problem with scrolling div for the messages that the scroll bar must be at the bottom as default. DIV <div class="chat-body chat-scroll" id="chat-scroll"></div> STYLE .chat-scroll{position: absolute; top:0px; bottom: 0px; overflow-y: auto;} I use JQuery for submit message from the input form to reload the content of the #chat-scroll and the auto scrolling is okay for submit, but when at first load of the page, the scroll only stays at the middle of the div #chat-scroll. Unlike if I submit a message it

Hide div by class id

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If I have <div id="ad1" class="ad"> and <div id="ad2" class="ad"> how can I hide both by hiding all divs with class ad I tried document.getElementsByClassName(ad).style.visibility="hidden"; but only this works function hidestuff(boxid){ document.getElementById(boxid).style.visibility="hidden"; } 回答1: As Matt Ball's clue left, you need to iterate through the results of your getElementsByClassName result. Try something along the lines of: var divsToHide = document.getElementsByClassName("ad"); for(var i = 0; i < divsToHide.length; i++) {