css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

<ul id="imagegallery">
  <li><a href="http://oqef2is9h.bkt.clouddn.com/1.jpg" title="first pic">图片一</a></li>
  <li><a href="http://oqef2is9h.bkt.clouddn.com/2.jpg" title="second pic">图片二</a></li>
  <li><a href="http://oqef2is9h.bkt.clouddn.com/3.jpg" title="third pic">图片三</a></li>
  <li><a href="http://oqef2is9h.bkt.clouddn.com/6.jpg" title="fourthly pic">图片四</a></li>

              body {
  color: #444;
  font-family: "微软雅黑";
ul li {
  display: inline-block;
  list-style: none;
a,a:hover {
  color: #444;
  text-decoration: none;

	a img {border:0;width:100px;}
function preparePlaceholder(){   
//	if(!document.createElement) return false;
//	if(!document.createTextNode) return false;
//	if(!document.getElementById) return false;
//	if(!document.getElementById("imagegallery")) return false;
	var img = document.createElement("img");
	img.setAttribute("alt","default pic");
	var p = document.createElement("p");
	var ptext = document.createTextNode("This is a description");
	var imagegallery=document.getElementById("imagegallery");

function showPic(whichpic){
	//if(!document.getElementById("placeholder")) return false;
	var placeholder=document.getElementById("placeholder");
	var href=whichpic.getAttribute("href");
	//if(placeholder.nodeName != "IMG") return false;
		var title=whichpic.getAttribute("title");
		var title="";
	var description=document.getElementById("description");
	return false;

function prepareGallery(){
	//if(!document.getElementsByTagName || !document.getElementById) return false;
	//if(!document.getElementById("imagegallery")) return false;
	var imagegallery=document.getElementById("imagegallery");
	var links=imagegallery.getElementsByTagName("a");
	for(var i=0;i<links.length;i++){
			return showPic(this);

function insertAfter(newElement,targetElement){
	var parent = targetElement.parentNode;
	if(parent.lastChild == targetElement){  //如果目标元素是parent的最后一个子元素,那就把新元素插入到追加到parent上,这样新元素就恰好被插入到目标元素后面
		parent.insertBefore(newElement,targetElement.nextSibling);  //如果不是,那就把新元素插入到目标元素的下一个兄弟元素的前面

function addLoadEvent(func){
	var oldonload=window.onload;
	if(typeof window.onload !="function"){

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................