div

Create a draggable div in native javascript [duplicate]

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Moveable/draggable 5 answers I want to create a movable/draggable div in native javascript without using jquery and libraries. Is there a tutorial or anythign? 回答1: OK, here's my personal code that I use for lightweight deployments (projects where using a library is either not allowed or overkill for some reason). First thing first, I always use this convenience function so that I can pass either an id or the actual dom element: function get (el) { if (typeof el == 'string') return document

Replace a div content with PHP

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: yesterday, I posted a question about "Hom to change a DIV id with a php function" and someone found the right answer with a regular expression. The problem is that I wanted to use this answer to aplly the method on other same problems. But, as I'm very bad at regular expressions, I couldn't. So the problem is that I upload some videos with FCKEditor and put the video script in my database and the result is like that: <div id="player959093-parent" style="text-align: center;float: left;"> <div style="border-style: none; height: 160px; width:

div + scroll + fixed bottom + variable top

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a problem with sizing a scrolling div to fill the window, considering that I have one or more top divs and a footer div. this is what I need +------------------+ +------------------+ +------------------+ | top1 | | top1 | | top1 | +------------------+ +------------------+ +------------------+ | top2 | | top2 | | |^| | | +------------------+ | | | +------------------+ | |^| | | | | |^| | | | | scroll | | | | | => | scroll | | => | | | | scroll | | | | | | | | | | | | | | | | | | | | | | | | | | | |v| | |v| | |v| +------------------+ +-

Download a div in a HTML page as pdf using javascript

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a content div with the id as "content". In the content div I have some graphs and some tables. I want to download that div as a pdf when user click on download button. Is there a way to do that using javascript or jQuery? 回答1: You can do it using jsPDF HTML: Hello, this is a H3 tag a pararaph generate PDF JavaScript: var doc = new jsPDF(); var specialElementHandlers = { '#editor': function (element, renderer) { return true; } }; $('#cmd').click(function () { doc.fromHTML($('#content').html(), 15, 15, { 'width': 1 7 0, 'elementHandlers

Div displays in Firefox, Safari, Chrome, etc. but not in Internet Explorer

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This div transition displays fine in most browsers, but not in Internet Exporer. You can see the error by clcking on the secondview link on the left. Here is the HTML and CSS source: <!DOCTYPE html> <!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="en"> <![endif]--> <!--[if IE 7 ]> <html class="ie ie7 no-js" lang="en"> <![endif]--> <!--[if IE 8 ]> <html class="ie ie8 no-js" lang="en"> <![endif]--> <!--[if IE 9 ]> <html class="ie ie9 no-js" lang="en"> <![endif]--> <!--[if gt IE 9]><!--><html class="no-js" lang="en"><!--<![endif]--> <head>

Resize image to 100% height of a div and keep aspect ratio

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here is a quick sketch. I would like to achieve that images in the gallery div will be 100% of the height of the gallery div and keep the aspect ratio AND that images would resize as you would change the size of browser. Is this possible? Any help would be much appreciated. Here is what I made so far: www.nulaena.si/photob/. 回答1: Something like this? body { padding:0;margin:0; } #header { position: absolute; background: orange; top:0; left:0; width: 100%; height: 100px; } #footer { position: absolute; background: orange; bottom: 0; left: 0;

How to bevel the corner of a block div?

匿名 (未验证) 提交于 2019-12-03 00:50:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following HTML document: Тег DIV */ /*--> */ Text Content How do I describe the style to get the following? 回答1: Until CSS4 border-corner-shape property is in danger! and it's not implemented , This can be done by using CSS3 transforms (to keep border property free for further usage): HTML: Text Content CSS: .box { width: 200px; height: 35px; line-height: 35px; padding: 0 5px; background-color: #ccc; padding-right: 20px; border: solid 1px black; border-right: 0; position: relative; } .box:after { content: ""; display: block;

CSS Container DIv Height. Floating DIV questions

匿名 (未验证) 提交于 2019-12-03 00:48:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can you force a container DIV height to accomodate two floated div children? Is there a fancy trick I can use to do that? I am trying to make two equally sized divs inside the parent div. I would like them to appear side by side with a little whitespace between them. Child2 tends to pop out and go below Child1. Note Child2 contains a table. Should I be floating? HTML: <div id="parent"> <div id="child1"></div> <div id="child2"> <table><tr><td>content</td></tr></table> </div> </div> CSS: div#parent { background-color: #C6E4E0; border: solid

How to make position:fixed div scroll horizontally

匿名 (未验证) 提交于 2019-12-03 00:48:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a div with position:fixed, as the image below suggests. I want it to be fixed vertically, but I want it to scroll horizontally with the rest of the content (notice the horizontal scroll bar). Is this possible with CSS? Or do I need Javascript (in this case, how could I do it)? 回答1: Old question, but I was also looking for a solution also, and found a nice simple jquery solution, and figured someone else might find it helpful if nothing else: with header being the div, and originalLeft being, well, the initial left:position. This also

Extend a Div the Length of it&#039;s Container

匿名 (未验证) 提交于 2019-12-03 00:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to extend my left sidebar so that it spans the length of the page (or the container DIV). I tried setting the height of the container to 100% and then the height of the sidebar to 100%, but that did not work. Here is my coding: div#container { overflow: hidden; margin-left: auto; margin-right: auto; margin-top: 0px; padding-bottom: 10px; width: 880px; height: 100%; text-align: left; } div#left { float: left; width: 280px; height: 100%; padding: 4px; background: #F1D7A5; } And here is what the page looks like: http://www