|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Magic buttons</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<meta name="description" content="">
|
|
|
|
<meta name="author" content="">
|
|
|
|
|
|
|
|
<!-- Le styles -->
|
|
|
|
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
|
|
|
|
<link href="css/bootstrap-magic-button.css" rel="stylesheet">
|
|
|
|
<link href="prettify/prettify.css" type="text/css" rel="stylesheet" />
|
|
|
|
<link href="example.css" type="text/css" rel="stylesheet" />
|
|
|
|
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
|
|
|
|
|
|
|
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
|
|
|
|
<!--[if lt IE 9]>
|
|
|
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
|
|
|
<![endif]-->
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body onload="prettyPrint()">
|
|
|
|
<a href="https://github.com/sp4ke/bootstrap-magic-button"><img style="position: absolute; top: 40px; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
|
|
|
|
|
|
|
|
<div class="navbar navbar-fixed-top">
|
|
|
|
<div class="navbar-inner">
|
|
|
|
<div class="container">
|
|
|
|
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
<span class="icon-bar"></span>
|
|
|
|
</a>
|
|
|
|
<a class="brand" href="#">Magic Buttons</a>
|
|
|
|
<div class="nav-collapse">
|
|
|
|
<ul class="nav">
|
|
|
|
<li class="active"><a href="#setup">Setup</a></li>
|
|
|
|
<li><a href="#example">Examples</a></li>
|
|
|
|
<li><a href="#methods">Methods</a></li>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
</div><!--/.nav-collapse -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="container">
|
|
|
|
<div class="hero-unit" style="text-align: center; margin-top: 20px">
|
|
|
|
<h2>Let your buttons fly </h2>
|
|
|
|
<br />
|
|
|
|
<p> It's a plugin that make it possible for any button to float on it's parent div
|
|
|
|
</p>
|
|
|
|
<button class="magicBtn hero"><a href="#example"><i class="icon-chevron-down"></i></a></button>
|
|
|
|
<button class="magicBtn hero"><a href="http://twitter.com/share?url=http://sp4ke.github.com/bootstrap-magic-button/&text=Bootstrap magic buttons @ChakibBenz&count=horiztonal" target="_blank" rel="nofollow"><i class="icon-retweet"></i></a></button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="span5">
|
|
|
|
<h2 id="setup">Setup</h2>
|
|
|
|
<ol>
|
|
|
|
<li>Include jQuery and jQueryui</li><br />
|
|
|
|
<li>Include stylesheet and js files <br/><br/><pre class="prettyprint"><link href="css/bootstrap-magic-button.css" rel="stylesheet"><br/><script src="jquery.hoverIntent.js"></script><br/><script src="bootstrap-magic-button.js"></script></pre></li>
|
|
|
|
<li>Include <code>class="magicBtn"</code> and <code>data-image="path/to/image.png"</code> to your buttons </li><br/>
|
|
|
|
<li>Start using : <pre class="prettyprint">$('.magicBtn').magicBtn('show');</pre></li>
|
|
|
|
<div class="alert alert-info">
|
|
|
|
<p>It is preferable to add your own class to group of magic buttons, use that class to customize groups of magic buttons </p>
|
|
|
|
<pre class="prettyprint"><button class="magicBtn myClass" ... /> </pre>
|
|
|
|
<pre class="prettyprint">$('.myClass').magicBtn('show');</pre>
|
|
|
|
</div>
|
|
|
|
</ol>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="span5">
|
|
|
|
<h2 id="example">Examples:</h2>
|
|
|
|
<hr />
|
|
|
|
<h3>Simple button</h3>
|
|
|
|
<br />
|
|
|
|
<div class="well span3">
|
|
|
|
<p>This is the most basic magic button, the default behavior is to stick on the right side
|
|
|
|
of div which is containing magic buttons
|
|
|
|
</p>
|
|
|
|
<button class="magicBtn" data-image="img/msg.png"></button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="span7">
|
|
|
|
<h2>Code:</h2>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<pre class="prettyprint linenums"><div class="well span3"><br/> <p>This is the most basic magic button, ...</p><br/><br/> <button class="magicBtn" data-image="img/msg.png"/><br/></div></pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="span5">
|
|
|
|
|
|
|
|
<h3>Toggle effect</h3>
|
|
|
|
|
|
|
|
<br />
|
|
|
|
<div class="well span3">
|
|
|
|
<p>Add a toggle effect using the <code>data-toggle="magicBtn"</code></p>
|
|
|
|
<button class="magicBtn" data-image="img/msg.png" data-toggle="magicBtn"/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="span7">
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<pre class="prettyprint linenums"><button class="magicBtn" data-image="img/msg.png" data-toggle="magicBtn"/><br/></pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="span5">
|
|
|
|
|
|
|
|
<h3>Toggle image</h3>
|
|
|
|
|
|
|
|
<br />
|
|
|
|
<div class="well span3">
|
|
|
|
<p>Use<code>data-toggle-image</code> to customize toggle image</p>
|
|
|
|
<button class="magicBtn" data-image="img/pin-off.png" data-toggle="magicBtn" data-toggle-image="img/pin-on.png"></button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="span7">
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<pre class="prettyprint linenums"><button class="magicBtn" data-image="img/pin-off.png" data-toggle="magicBtn" data-toggle-image="img/pin-on.png"/></pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="span5">
|
|
|
|
|
|
|
|
<h3>Hover effect</h3>
|
|
|
|
|
|
|
|
<br />
|
|
|
|
<div class="well span3">
|
|
|
|
<p>You can enable a hover effect over your buttons</p>
|
|
|
|
<p>jquery.hoverIntent is used in replacement of jQuery builtin hover</p>
|
|
|
|
<button class="magicBtn hover" data-image="img/pin-off.png" data-toggle="magicBtn" data-toggle-image="img/pin-on.png"></button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="span7">
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<pre class="prettyprint linenums"><button class="magicBtn hover" data-image="img/pin-off.png" data-toggle="magicBtn" data-toggle-image="img/pin-on.png"/></pre>
|
|
|
|
<pre class="prettyprint linenums">$('.hover').magicBtn({hover: true});<br/>$('.hover').magicBtn('show');</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="span5">
|
|
|
|
|
|
|
|
<h3>How about bootstrap icons ? </h3>
|
|
|
|
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<div class="well span3">
|
|
|
|
<p>Just put the icons inside the button</p>
|
|
|
|
<button class="magicBtn icon"><i class="icon-search"></i></button>
|
|
|
|
<button class="magicBtn icon"><i class="icon-user"></i></button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="span7">
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<pre class="prettyprint linenums"><button class="magicBtn icon"><i class="icon-search"></i></button><br/><button class="magicBtn icon"><i class="icon-user"></i></button><br/></pre>
|
|
|
|
<pre class="prettyprint linenums">$('.icon').magicBtn({hover: true, alignement: 'top'});<br/>$('.icon').magicBtn('show');</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<br />
|
|
|
|
<div class="span10">
|
|
|
|
<h3 id="methods">Methods</h3>
|
|
|
|
<h4>$().magicBtn('show')</h4>
|
|
|
|
<p>Shows the buttons found by selector</p>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<h4>$().magicBtn('hide')</h4>
|
|
|
|
<p>Hides the buttons found by selector</p>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<h4>$().magicBtn('toggle')</h4>
|
|
|
|
<p>Activates toggle state</p>
|
|
|
|
<div class="alert alert-info">
|
|
|
|
<p>You can enable auto toggling of a button by using <code>data-toggle</code> attribute</p>
|
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<h3>Options</h3>
|
|
|
|
<br />
|
|
|
|
<table class="table table-bordered table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th style="width: 100px;">Name</th>
|
|
|
|
<th style="width: 100px;">type</th>
|
|
|
|
<th style="width: 50px;">default</th>
|
|
|
|
<th>description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tr>
|
|
|
|
<td>alignement</td>
|
|
|
|
<td>string</td>
|
|
|
|
<td>center</td>
|
|
|
|
<td>start showing buttons from center, 1 in middle, even on ones top and odd ones on bottom </td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>betweenSpace</td>
|
|
|
|
<td>integer</td>
|
|
|
|
<td>2</td>
|
|
|
|
<td>space between buttons</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>hover</td>
|
|
|
|
<td>boolean</td>
|
|
|
|
<td>false</td>
|
|
|
|
<td>Enables hover effect</td>
|
|
|
|
</tr>
|
|
|
|
<tbody>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<footer class="footer">
|
|
|
|
<p>Built by <a href="https://twitter.com/#!/chakibBenz">@chakibBenz</a></p>
|
|
|
|
<p>Code licensed under the Apache License v2.0</p>
|
|
|
|
</footer> <!-- footer -->
|
|
|
|
|
|
|
|
</div> <!-- /container -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Le javascript
|
|
|
|
================================================== -->
|
|
|
|
<!-- Placed at the end of the document so the pages load faster -->
|
|
|
|
<script type="text/javascript" src="prettify/prettify.js"></script>
|
|
|
|
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
|
|
|
|
<script src="bootstrap/js/bootstrap.min.js"></script>
|
|
|
|
<script>
|
|
|
|
google.load("jqueryui", "1.8.17");
|
|
|
|
</script>
|
|
|
|
<script src="js/jquery.hoverIntent.js"></script>
|
|
|
|
<script src="js/bootstrap-magic-button.js"></script>
|
|
|
|
<script>
|
|
|
|
$(function () {
|
|
|
|
$('.hover').magicBtn({hover: true});
|
|
|
|
$('.hover').magicBtn('show');
|
|
|
|
|
|
|
|
$('.icon').magicBtn({hover: true, alignement: 'top'});
|
|
|
|
$('.icon').magicBtn('show');
|
|
|
|
|
|
|
|
$('.well .magicBtn').magicBtn('show');
|
|
|
|
|
|
|
|
|
|
|
|
$('.hero').magicBtn({hover: true, alignement: 'top'});
|
|
|
|
$('.hero-unit').hoverIntent({
|
|
|
|
over: function () {
|
|
|
|
$('.hero').magicBtn('show');
|
|
|
|
},
|
|
|
|
timeout: 200,
|
|
|
|
out: function () {
|
|
|
|
$('.hero').magicBtn('hide');
|
|
|
|
}}
|
|
|
|
)
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|