mirror of
https://github.com/docker/docs.git
synced 2026-03-27 22:38:54 +07:00
715 lines
25 KiB
HTML
715 lines
25 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta name="description" content="Getting started with Docker">
|
|
<meta name="keywords" content="[beginner, tutorial, Docker]">
|
|
<title>Create a Docker Hub account and repository </title>
|
|
<link rel="shortcut icon" href="https://docs.docker.com/images/favicon.png" type="image/x-icon">
|
|
<link rel="stylesheet" href="/dist/assets/css/bootstrap-custom.css"/>
|
|
<link rel="stylesheet" href="/dist/assets/css/app.css" />
|
|
<link rel="stylesheet" href="/dist/assets/css/bootstrap-custom.css"/>
|
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.6/animate.min.css">
|
|
<link rel="stylesheet" href="../../css/custom.css">
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
|
<script src="../../dist/assets/js/modernizr.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="off-canvas-wrap" data-offcanvas>
|
|
<div class="inner-wrap">
|
|
|
|
<a class="left-off-canvas-toggle" href="#" >
|
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="35px" height="35px" viewBox="0 0 35 35" enable-background="new 0 0 35 35" xml:space="preserve">
|
|
<path fill="#3597D4" d="M30.583,9.328c0,0.752-0.539,1.362-1.203,1.362H5.113c-0.664,0-1.203-0.61-1.203-1.362l0,0
|
|
c0-0.752,0.539-1.362,1.203-1.362H29.38C30.045,7.966,30.583,8.576,30.583,9.328L30.583,9.328z"/>
|
|
<path fill="#3597D4" d="M30.583,17.09c0,0.752-0.539,1.362-1.203,1.362H5.113c-0.664,0-1.203-0.61-1.203-1.362l0,0
|
|
c0-0.752,0.539-1.362,1.203-1.362H29.38C30.045,15.728,30.583,16.338,30.583,17.09L30.583,17.09z"/>
|
|
<path fill="#3597D4" d="M30.583,24.387c0,0.752-0.539,1.362-1.203,1.362H5.113c-0.664,0-1.203-0.61-1.203-1.362l0,0
|
|
c0-0.752,0.539-1.362,1.203-1.362H29.38C30.045,23.025,30.583,23.635,30.583,24.387L30.583,24.387z"/>
|
|
</svg>
|
|
</a>
|
|
<a class="button secondary small get-started-cta">Get Started</a>
|
|
<header class="main-header">
|
|
<div class="row">
|
|
<div class="large-3 columns">
|
|
<a href="../../"><img class="logo" src="../../dist/assets/images/logo.png"></a>
|
|
</div>
|
|
<div class="large-9 columns">
|
|
<ul class="nav-global">
|
|
<li><a href="https://www.docker.com/support">Support</a></li>
|
|
<li><a href="https://training.docker.com/">Training</a></li>
|
|
<li><a href="https://docs.docker.com/">Docs</a></li>
|
|
<li><a href="http://blog.docker.com/">Blog</a></li>
|
|
<li><a href="https://hub.docker.com/">Docker Hub</a></li>
|
|
<li><a class="button" href="../../mac/started/">Get Started</a></li>
|
|
</ul>
|
|
<ul class="nav-main">
|
|
<li><a href="https://www.docker.com/products">Products</a>
|
|
<ul>
|
|
<li><a href="https://www.docker.com/pricing">Pricing</a></li>
|
|
<li><a href="https://www.docker.com/whatisdocker">What is Docker?</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="https://www.docker.com/customers">Customers</a></li>
|
|
<li><a href="https://www.docker.com/community">Community</a>
|
|
<ul>
|
|
<li><a href="https://www.docker.com/community/meetups">Meetups</a></li>
|
|
<li><a href="https://www.docker.com/community/events">Events</a></li>
|
|
<li><a href="https://forums.docker.com">Forums</a></li>
|
|
<li><a href="http://www.scoop.it/t/docker-by-docker">Community News</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="https://www.docker.com/partners">Partners</a>
|
|
<ul>
|
|
<li><a href="https://www.docker.com/partners/partner-programs">Partner Programs</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="https://www.docker.com/company">Company</a>
|
|
<ul>
|
|
<li><a href="https://www.docker.com/news-and-press">News & Press</a></li>
|
|
<li><a href="https://www.docker.com/work-docker">Work at Docker</a></li>
|
|
<li><a href="https://www.docker.com/company/management">Management</a></li>
|
|
<li><a href="https://www.docker.com/company/contact">Contact</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="https://www.docker.com/open-source">Open Source</a>
|
|
<ul>
|
|
<li><a href="https://www.docker.com/contribute">Contribute</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
|
|
<aside class="left-off-canvas-menu">
|
|
<ul class="off-canvas-list">
|
|
<li class="has-submenu"><a href="#">Products</a>
|
|
<ul class="left-submenu">
|
|
<li class="back"><a href="#">Back</a></li>
|
|
<li><a href="#">Pricing</a></li>
|
|
<li><a href="#">What Is Docker</a></li>
|
|
<li><a href="#">Products</a></li>
|
|
<li><a href="#">Docker Engine</a></li>
|
|
<li><a href="#">Docker Hub</a></li>
|
|
<li><a href="#">Docker Registry</a></li>
|
|
<li><a href="#">Docker Machine</a></li>
|
|
<li><a href="#">Docker Swarm</a></li>
|
|
<li><a href="#">Docker Compose</a></li>
|
|
<li><a href="#">Kitematic</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#">Customers</a></li>
|
|
<li class="has-submenu"><a href="#">Community</a>
|
|
<ul class="left-submenu">
|
|
<li class="back"><a href="#">Back</a></li>
|
|
<li><a href="#">Community</a></li>
|
|
<li><a href="#">Meetups</a></li>
|
|
<li><a href="https://www.docker.com/community/events">Events</a></li>
|
|
<li><a href="#">Forum</a></li>
|
|
<li><a href="#">Scoop.it</a></li>
|
|
</ul>
|
|
</li>
|
|
<li class="has-submenu"><a href="#">Partners</a>
|
|
<ul class="left-submenu">
|
|
<li class="back"><a href="#">Back</a></li>
|
|
<li><a href="#">Partners</a></li>
|
|
<li><a href="https://www.docker.com/partners/partner-programs">Partners Programs</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#">Company</a></li>
|
|
<li class="has-submenu"><a href="#">Open Source</a>
|
|
<ul class="left-submenu">
|
|
<li class="back"><a href="#">Back</a></li>
|
|
<li><a href="#">Open Source</a></li>
|
|
<li><a href="#">Contribute</a></li>
|
|
<li><a href="#">Governance</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<ul class="nav-global-off-canvas">
|
|
<li><a href="#">Support</a></li>
|
|
<li><a href="#">Training</a></li>
|
|
<li><a href="#">Docs</a></li>
|
|
<li><a href="#">Blog</a></li>
|
|
<li><a href="#">Sign in</a></li>
|
|
<li><a href="#">Sign up</a></li>
|
|
</ul>
|
|
</aside>
|
|
|
|
<a class="exit-off-canvas"></a>
|
|
<div class="row">
|
|
<div class="large-3 columns" class="tutmenu">
|
|
<section id="multiple" class="tutmenu" data-accordion-group>
|
|
|
|
|
|
<section data-accordion>
|
|
|
|
<a data-link href="../../linux/started/" class=""> Get Started with Docker</a>
|
|
|
|
</section>
|
|
|
|
<section data-accordion>
|
|
|
|
<a data-link href="../../linux/step_one/" class=""> Install Docker</a>
|
|
|
|
</section>
|
|
|
|
<section data-accordion>
|
|
|
|
<a data-link href="../../linux/step_two/" class=""> Understand images & containers</a>
|
|
|
|
</section>
|
|
|
|
<section data-accordion>
|
|
|
|
<a data-link href="../../linux/step_three/" class=""> Find & run the whalesay image </a>
|
|
|
|
</section>
|
|
|
|
<section data-accordion>
|
|
|
|
<a data-link href="../../linux/step_four/" class=""> Build your own image</a>
|
|
|
|
</section>
|
|
|
|
<section data-accordion>
|
|
|
|
<a data-link href="../../linux/step_five/" class=" active"> Create a Docker Hub account and repository </a>
|
|
|
|
</section>
|
|
|
|
<section data-accordion>
|
|
|
|
<a data-link href="../../linux/step_six/" class=""> Tag & push your image</a>
|
|
|
|
</section>
|
|
|
|
<section data-accordion>
|
|
|
|
<a data-link href="../../linux/last_page/" class=""> Learning More</a>
|
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
<script>
|
|
$(document).ready(function () {
|
|
var $activeLink = $('#multiple [data-link].active');
|
|
var $accordions = $activeLink.parents('article[data-accordion]');
|
|
$($accordions.get().reverse()).each(function (index, accordion) {
|
|
var $accordion = $(accordion);
|
|
var $content = $accordion.find('[data-content]');
|
|
$accordion.addClass('open');
|
|
$content.css({'max-height': '100%'});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
</div>
|
|
<div class="large-9 columns">
|
|
<section id="main">
|
|
<article id="content" class="tutorial">
|
|
<div class="linux" >
|
|
|
|
|
|
<h1 id="create-a-docker-hub-account-repository">Create a Docker Hub account & repository</h1>
|
|
|
|
<p>You’ve built something really cool, you should share it. In this next section,
|
|
you’ll do just that. You’ll need a Docker Hub account. Then, you’ll push your
|
|
image up to it so other people with Docker can run it.</p>
|
|
|
|
<h2 id="step-1-sign-up-for-an-account">Step 1: Sign up for an account</h2>
|
|
|
|
<ol>
|
|
<li><p>Use your browser to navigate to <a href="https://hub.docker.com/?utm_source=getting_started_guide&utm_medium=embedded_Linux&utm_campaign=create_docker_hub_account" target="_blank">the Docker Hub signup page</a>.</p>
|
|
|
|
<p>Your browser displays the page.</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../../tutimg/hub_signup.png" />
|
|
|
|
|
|
</figure>
|
|
</li>
|
|
|
|
<li><p>Fill out the form on the signup page.</p>
|
|
|
|
<p>Docker Hub is free. Docker does need a name, password, and email address.</p></li>
|
|
|
|
<li><p>Press <strong>Signup</strong>.</p>
|
|
|
|
<p>The browser displays the welcome to Docker Hub page.</p></li>
|
|
</ol>
|
|
|
|
<h2 id="step-2-verify-your-email-and-add-a-repository">Step 2: Verify your email and add a repository</h2>
|
|
|
|
<p>Before you can share anything on the hub, you need to verify your email address.</p>
|
|
|
|
<ol>
|
|
<li><p>Open your email inbox.</p></li>
|
|
|
|
<li><p>Look for the email titled <code>Please confirm email for your Docker Hub account</code>.</p>
|
|
|
|
<p>If you don’t see the email, check your Spam folder or wait a moment for the
|
|
email to arrive.</p></li>
|
|
|
|
<li><p>Open the email and click the <strong>Confirm Your Email</strong> button.</p>
|
|
|
|
<p>The browser opens Docker Hub to your profile page.</p></li>
|
|
|
|
<li><p>Choose <strong>Create Repository</strong>.</p>
|
|
|
|
<p>The browser opens the <strong>Create Repository</strong> page.</p></li>
|
|
|
|
<li><p>Provide a Repository Name and Short Description.</p></li>
|
|
|
|
<li><p>Make sure Visibility is set to <strong>Public</strong>.</p>
|
|
|
|
<p>When you are done, your form should look similar to the following:</p>
|
|
|
|
|
|
<figure >
|
|
|
|
<img src="../../tutimg/add_repository.png" />
|
|
|
|
|
|
</figure>
|
|
</li>
|
|
|
|
<li><p>Press <strong>Create</strong> when you are done.</p>
|
|
|
|
<p>Docker Hub creates your new repository.</p></li>
|
|
</ol>
|
|
|
|
<h2 id="where-to-go-next">Where to go next</h2>
|
|
|
|
<p>On this page, you opened an account on Docker Hub and created a new repository.
|
|
In the next section, you populate the repository <a href="../../linux/step_six/">by tagging and pushing the
|
|
image you created earlier</a>.</p>
|
|
|
|
<p> </p>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<footer class="main-footer">
|
|
<div class="row">
|
|
</div>
|
|
<div class="row">
|
|
</div>
|
|
<div id="buildinfo">
|
|
Nov 3, 2015 at 7:59pm (PST)
|
|
{
|
|
"docker/compose": {
|
|
"ref": "docs",
|
|
"repos": [
|
|
"git@github.com:docker/compose.git"
|
|
],
|
|
"sha": "9c8173dbfda93baef214359991b6a8a54172f6ae"
|
|
},
|
|
"docker/docker-hub": {
|
|
"ref": "master",
|
|
"repos": [
|
|
"git@github.com:docker/hub2-demo.git"
|
|
],
|
|
"sha": "4b2e522c81c860d63b126342a6b981ac0ff1605c"
|
|
},
|
|
"docker/docker-trusted-registry": {
|
|
"ref": "docs",
|
|
"repos": [
|
|
"git@github.com:docker/dhe-deploy.git"
|
|
],
|
|
"sha": "b8988465878952f2e2c2472e8fc5fd35e5975fbf"
|
|
},
|
|
"docker/docs-base": {
|
|
"ref": "hugo-github-linking",
|
|
"repos": [
|
|
"git@github.com:docker/docs-base.git"
|
|
],
|
|
"sha": "dc98c0381a6cc311c9e3189dc78a3c7e62e5a205"
|
|
},
|
|
"docker/engine": {
|
|
"ref": "master",
|
|
"repos": [
|
|
"git@github.com:docker/docker.git"
|
|
],
|
|
"sha": "474b16af8ecfe94ec635dfac60025348d3186aa3"
|
|
},
|
|
"docker/machine": {
|
|
"ref": "master",
|
|
"repos": [
|
|
"git@github.com:docker/machine.git"
|
|
],
|
|
"sha": "786437901c0c883ecb59c1e0531654c1d89b326d"
|
|
},
|
|
"docker/opensource": {
|
|
"ref": "master",
|
|
"repos": [
|
|
"git@github.com:docker/opensource.git"
|
|
],
|
|
"sha": "0cd99bcdd876ca0293d8944980c79f32064b6354"
|
|
},
|
|
"docker/registry": {
|
|
"ref": "master",
|
|
"repos": [
|
|
"git@github.com:docker/distribution.git"
|
|
],
|
|
"sha": "a9da0e510032314910b5405acc50873ab2fa2e5a"
|
|
},
|
|
"docker/swarm": {
|
|
"ref": "master",
|
|
"repos": [
|
|
"git@github.com:docker/swarm.git"
|
|
],
|
|
"sha": "087e2452f3ec474f112b4e5b8c52b8dacb5751be"
|
|
},
|
|
"docker/tutorials": {
|
|
"ref": "master",
|
|
"repos": [
|
|
"git@github.com:docker/tutorials.git"
|
|
],
|
|
"sha": "cb55d4de0df55e22f443aac664d66f092f06c56b"
|
|
},
|
|
"docs.docker.com": {
|
|
"ref": "refs/heads/1-9-release",
|
|
"repos": [
|
|
"git@github.com:moxiegirl/docs.docker.com.git",
|
|
"git@github.com:docker/docs.docker.com.git"
|
|
],
|
|
"sha": "5878eae5de6f012c67a2a4772327c9948274c351"
|
|
},
|
|
"kitematic/kitematic": {
|
|
"ref": "master",
|
|
"repos": [
|
|
"git@github.com:kitematic/kitematic.git"
|
|
],
|
|
"sha": "e533ed35d2eab31ce528675b0665f97516b4147b"
|
|
}
|
|
} </div>
|
|
</footer>
|
|
<link rel="stylesheet" href="../../highlight/styles/github.css">
|
|
<script src="../../highlight/highlight.pack.js"></script>
|
|
<script>hljs.initHighlightingOnLoad();</script>
|
|
|
|
<script src="../../dist/assets/js/all.js"></script>
|
|
<script>
|
|
$( 'nav li:has(ul)' ).doubleTapToGo();
|
|
</script>
|
|
<script>
|
|
|
|
;(function ( $, window, document, undefined ) {
|
|
|
|
var pluginName = 'accordion',
|
|
defaults = {
|
|
transitionSpeed: 300,
|
|
transitionEasing: 'ease',
|
|
controlElement: '[data-control]',
|
|
contentElement: '[data-content]',
|
|
groupElement: '[data-accordion-group]',
|
|
singleOpen: true
|
|
};
|
|
|
|
function Accordion(element, options) {
|
|
this.element = element;
|
|
this.options = $.extend({}, defaults, options);
|
|
this._defaults = defaults;
|
|
this._name = pluginName;
|
|
this.init();
|
|
}
|
|
|
|
Accordion.prototype.init = function () {
|
|
var self = this,
|
|
opts = self.options;
|
|
|
|
var $accordion = $(self.element),
|
|
$controls = $accordion.find('> ' + opts.controlElement),
|
|
$content = $accordion.find('> ' + opts.contentElement);
|
|
|
|
var accordionParentsQty = $accordion.parents('[data-accordion]').length,
|
|
accordionHasParent = accordionParentsQty > 0;
|
|
|
|
var closedCSS = { 'max-height': 0, 'overflow': 'hidden' };
|
|
|
|
var CSStransitions = supportsTransitions();
|
|
|
|
function debounce(func, threshold, execAsap) {
|
|
var timeout;
|
|
|
|
return function debounced() {
|
|
var obj = this,
|
|
args = arguments;
|
|
|
|
function delayed() {
|
|
if (!execAsap) func.apply(obj, args);
|
|
timeout = null;
|
|
};
|
|
|
|
if (timeout) clearTimeout(timeout);
|
|
else if (execAsap) func.apply(obj, args);
|
|
|
|
timeout = setTimeout(delayed, threshold || 100);
|
|
};
|
|
}
|
|
|
|
function supportsTransitions() {
|
|
var b = document.body || document.documentElement,
|
|
s = b.style,
|
|
p = 'transition';
|
|
|
|
if (typeof s[p] == 'string') {
|
|
return true;
|
|
}
|
|
|
|
var v = ['Moz', 'webkit', 'Webkit', 'Khtml', 'O', 'ms'];
|
|
|
|
p = 'Transition';
|
|
|
|
for (var i=0; i<v.length; i++) {
|
|
if (typeof s[v[i] + p] == 'string') {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function requestAnimFrame(cb) {
|
|
if(window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame) {
|
|
return requestAnimationFrame(cb) ||
|
|
webkitRequestAnimationFrame(cb) ||
|
|
mozRequestAnimationFrame(cb);
|
|
} else {
|
|
return setTimeout(cb, 1000 / 60);
|
|
}
|
|
}
|
|
|
|
function toggleTransition($el, remove) {
|
|
if(!remove) {
|
|
$content.css({
|
|
'-webkit-transition': 'max-height ' + opts.transitionSpeed + 'ms ' + opts.transitionEasing,
|
|
'transition': 'max-height ' + opts.transitionSpeed + 'ms ' + opts.transitionEasing
|
|
});
|
|
} else {
|
|
$content.css({
|
|
'-webkit-transition': '',
|
|
'transition': ''
|
|
});
|
|
}
|
|
}
|
|
|
|
function calculateHeight($el) {
|
|
var height = 0;
|
|
|
|
$el.children().each(function() {
|
|
height = height + $(this).outerHeight(true);
|
|
});
|
|
|
|
$el.data('oHeight', height);
|
|
}
|
|
|
|
function updateParentHeight($parentAccordion, $currentAccordion, qty, operation) {
|
|
var $content = $parentAccordion.filter('.open').find('> [data-content]'),
|
|
$childs = $content.find('[data-accordion].open > [data-content]'),
|
|
$matched;
|
|
|
|
if(!opts.singleOpen) {
|
|
$childs = $childs.not($currentAccordion.siblings('[data-accordion].open').find('> [data-content]'));
|
|
}
|
|
|
|
$matched = $content.add($childs);
|
|
|
|
if($parentAccordion.hasClass('open')) {
|
|
$matched.each(function() {
|
|
var currentHeight = $(this).data('oHeight');
|
|
|
|
switch (operation) {
|
|
case '+':
|
|
$(this).data('oHeight', currentHeight + qty);
|
|
break;
|
|
case '-':
|
|
$(this).data('oHeight', currentHeight - qty);
|
|
break;
|
|
default:
|
|
throw 'updateParentHeight method needs an operation';
|
|
}
|
|
|
|
$(this).css('max-height', $(this).data('oHeight'));
|
|
});
|
|
}
|
|
}
|
|
|
|
function refreshHeight($accordion) {
|
|
if($accordion.hasClass('open')) {
|
|
var $content = $accordion.find('> [data-content]'),
|
|
$childs = $content.find('[data-accordion].open > [data-content]'),
|
|
$matched = $content.add($childs);
|
|
|
|
calculateHeight($matched);
|
|
|
|
$matched.css('max-height', $matched.data('oHeight'));
|
|
}
|
|
}
|
|
|
|
function closeAccordion($accordion, $content) {
|
|
$accordion.trigger('accordion.close');
|
|
|
|
if(CSStransitions) {
|
|
if(accordionHasParent) {
|
|
var $parentAccordions = $accordion.parents('[data-accordion]');
|
|
|
|
updateParentHeight($parentAccordions, $accordion, $content.data('oHeight'), '-');
|
|
}
|
|
|
|
$content.css(closedCSS);
|
|
|
|
$accordion.removeClass('open');
|
|
} else {
|
|
$content.css('max-height', $content.data('oHeight'));
|
|
|
|
$content.animate(closedCSS, opts.transitionSpeed);
|
|
|
|
$accordion.removeClass('open');
|
|
}
|
|
}
|
|
|
|
function openAccordion($accordion, $content) {
|
|
$accordion.trigger('accordion.open');
|
|
if(CSStransitions) {
|
|
toggleTransition($content);
|
|
|
|
if(accordionHasParent) {
|
|
var $parentAccordions = $accordion.parents('[data-accordion]');
|
|
|
|
updateParentHeight($parentAccordions, $accordion, $content.data('oHeight'), '+');
|
|
}
|
|
|
|
requestAnimFrame(function() {
|
|
$content.css('max-height', $content.data('oHeight'));
|
|
});
|
|
|
|
$accordion.addClass('open');
|
|
} else {
|
|
$content.animate({
|
|
'max-height': $content.data('oHeight')
|
|
}, opts.transitionSpeed, function() {
|
|
$content.css({'max-height': 'none'});
|
|
});
|
|
|
|
$accordion.addClass('open');
|
|
}
|
|
}
|
|
|
|
function closeSiblingAccordions($accordion) {
|
|
var $accordionGroup = $accordion.closest(opts.groupElement);
|
|
|
|
var $siblings = $accordion.siblings('[data-accordion]').filter('.open'),
|
|
$siblingsChildren = $siblings.find('[data-accordion]').filter('.open');
|
|
|
|
var $otherAccordions = $siblings.add($siblingsChildren);
|
|
|
|
$otherAccordions.each(function() {
|
|
var $accordion = $(this),
|
|
$content = $accordion.find(opts.contentElement);
|
|
|
|
closeAccordion($accordion, $content);
|
|
});
|
|
|
|
$otherAccordions.removeClass('open');
|
|
}
|
|
|
|
function toggleAccordion() {
|
|
var isAccordionGroup = (opts.singleOpen) ? $accordion.parents(opts.groupElement).length > 0 : false;
|
|
|
|
calculateHeight($content);
|
|
|
|
if(isAccordionGroup) {
|
|
closeSiblingAccordions($accordion);
|
|
}
|
|
|
|
if($accordion.hasClass('open')) {
|
|
closeAccordion($accordion, $content);
|
|
} else {
|
|
openAccordion($accordion, $content);
|
|
}
|
|
}
|
|
|
|
function addEventListeners() {
|
|
$controls.on('click', toggleAccordion);
|
|
|
|
$controls.on('accordion.toggle', function() {
|
|
if(opts.singleOpen && $controls.length > 1) {
|
|
return false;
|
|
}
|
|
|
|
toggleAccordion();
|
|
});
|
|
|
|
$(window).on('resize', debounce(function() {
|
|
refreshHeight($accordion);
|
|
}));
|
|
}
|
|
|
|
function setup() {
|
|
$content.each(function() {
|
|
var $curr = $(this);
|
|
|
|
if($curr.css('max-height') != 0) {
|
|
if(!$curr.closest('[data-accordion]').hasClass('open')) {
|
|
$curr.css({ 'max-height': 0, 'overflow': 'hidden' });
|
|
} else {
|
|
toggleTransition($curr);
|
|
calculateHeight($curr);
|
|
|
|
$curr.css('max-height', $curr.data('oHeight'));
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
if(!$accordion.attr('data-accordion')) {
|
|
$accordion.attr('data-accordion', '');
|
|
$accordion.find(opts.controlElement).attr('data-control', '');
|
|
$accordion.find(opts.contentElement).attr('data-content', '');
|
|
}
|
|
}
|
|
|
|
setup();
|
|
addEventListeners();
|
|
};
|
|
|
|
$.fn[pluginName] = function ( options ) {
|
|
return this.each(function () {
|
|
if (!$.data(this, 'plugin_' + pluginName)) {
|
|
$.data(this, 'plugin_' + pluginName,
|
|
new Accordion( this, options ));
|
|
}
|
|
});
|
|
}
|
|
|
|
})( jQuery, window, document );
|
|
|
|
$(document).ready(function() {
|
|
$('#multiple [data-accordion]').accordion({
|
|
singleOpen: false
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
<script src="/dist/assets/js/bootstrap-3.0.3.min.js"></script>
|
|
<script src="/dist/assets/js/archive.js"></script>
|
|
<script type="text/javascript">
|
|
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
|
|
analytics.load("IWj9D0UpZHZdZUZX9jl98PcpBFWBnBMy");
|
|
analytics.page();
|
|
}}();
|
|
</script>
|
|
|