Browse Source

tests : add notes and buttons

pull/96/head
David DeSandro 14 years ago
parent
commit
6a4997b017
  1. 19
      _posts/tests/2011-03-27-destroy01.html
  2. 4
      _posts/tests/2011-03-27-no-items01.html
  3. 40
      _posts/tests/2011-04-26-item-position-data01.html

19
_posts/tests/2011-03-27-destroy01.html

@ -12,7 +12,12 @@ category: tests
</style> </style>
<section id="copy"> <section id="copy">
<p>After <code>destroy</code>-ing Isotope, original CSS gets re-applied</p> <p>Click <em>init</em> button the <em>destroy</em>. Original CSS, pre-init, should be re-applied, all items back to visibility.</p>
</section>
<section id="options">
<button id="init">Init Isotope instance</button>
<button id="destroy">Destroy Isotope instance</button>
</section> </section>
<div id="container" style="height: 600px"> <div id="container" style="height: 600px">
@ -28,9 +33,15 @@ category: tests
var $container = $('#container'); var $container = $('#container');
$container.isotope({ $('#init').click(function(){
itemSelector: '.element', $container.isotope({
filter: '.metal' itemSelector: '.element',
filter: '.metal'
});
});
$('#destroy').click(function(){
$container.isotope('destroy');
}); });
}); });

4
_posts/tests/2011-03-27-no-items01.html

@ -5,7 +5,7 @@ category: tests
--- ---
<section id="copy"> <section id="copy">
<p>What happens when there are no items for Isotope/</p> <p>What happens when there are no items for Isotope? If no items match `itemSelector`, container collapses. Plugin still <code>return this</code>.</p>
</section> </section>
<div id="container"> <div id="container">
@ -23,7 +23,7 @@ category: tests
$container.isotope({ $container.isotope({
itemSelector: '.foo' itemSelector: '.foo'
}); }).css('border', '10px solid');
}); });
</script> </script>

40
_posts/tests/2011-04-26-item-position-data01.html

@ -5,30 +5,11 @@ category: tests
--- ---
<section id="copy"> <section id="copy">
<p></p> <p><code>itemPositionDataEnabled</code> option is enabled. </p>
</section> </section>
<section id="options" class="clearfix"> <section id="options" class="clearfix">
<h3>Filters</h3>
<ul id="filters" class="option-set floated clearfix">
<li><a href="#show-all" class="selected">show all</a></li>
<li><a href="#metalloid">metalloid</a></li>
<li><a href="#metal">metal</a></li>
<li><a href="#alkali">alkali</a></li>
<li><a href="#alkaline-earth">alkaline-earth</a></li>
<li><a href="#inner-transition">inner-transition</a></li>
<li><a href="#lanthanoid">lanthanoid</a></li>
<li><a href="#actinoid">actinoid</a></li>
<li><a href="#transition">transition</a></li>
<li><a href="#post-transition">post-transition</a></li>
<li><a href="#nonmetal">nonmetal</a></li>
<li><a href="#other">other</a></li>
<li><a href="#halogen">halogen</a></li>
<li><a href="#noble-gas">noble-gas</a></li>
</ul>
{% include sort-buttons.html %} {% include sort-buttons.html %}
<h3>Etc</h3> <h3>Etc</h3>
@ -39,7 +20,7 @@ category: tests
</ul> </ul>
</section> <!-- #options --> </section> <!-- #options -->
<div id="container"> <div id="container" class="clickable clearfix">
{% for element in site.elements limit:40 %} {% for element in site.elements limit:40 %}
{% include element-partial.html %} {% include element-partial.html %}
{% endfor %} {% endfor %}
@ -48,16 +29,25 @@ category: tests
<script src="../{{ site.jquery_js }}"></script> <script src="../{{ site.jquery_js }}"></script>
<script src="../{{ site.isotope_js }}"></script> <script src="../{{ site.isotope_js }}"></script>
<script> <script>
$(function(){ $(function(){
var $container = $('#container'); var $container = $('#container');
{% include sort-buttons.js %} {% include sort-buttons.js %}
// change size of clicked element // toggle variable sizes of all elements
$container.find('.element').live('click', function(){ $('#toggle-sizes').find('a').click(function(){
$(this).toggleClass('large'); $container
$container.isotope('reLayout'); .toggleClass('variable-sizes')
.isotope('reLayout');
return false;
});
// log item position
$container.find('.element').click(function(){
var position = $(this).data('isotope-item-position');
console.log( position.x + ', ' + position.y );
}); });
$container.isotope({ $container.isotope({

Loading…
Cancel
Save