Reputation:
http://bit.ly/19GXxDy under the Etc section of the filters, there is a toggle size function. using this we made a page as a basic sample to build an HTML page with portfolio vector logos, upgrading to V2 using the sites samples is failing. Are we using the wrong methods?
What's changed and what are we doing wrong. We're trying to upgrade to V2 and unable to get the same toggle tile size to work in V2,
// V1 toggle variable sizes of all elements
$('#toggle-sizes').find('a').click(function(){
$container
.toggleClass('variable-sizes')
.isotope('reLayout');
return false;
});
// in V2 change size of all item by toggling class, doesnt work
$container.on( 'click', function() {
$(this).toggleClass('variable-sizes');
$container.isotope('layout');
});
Upvotes: 1
Views: 269
Reputation: 5444
I am assuming you have defined your variable $container in your code? What seems to be happening with your v2 code is you have a click on the $container toggle the class 'variable-sizes', on the $container itself, which is $(this) in your code, not your link 'a'.
you want to do this instead:
$container.on( 'click','a', function() {
$(this).toggleClass('variable-sizes');
$container.isotope('layout');
});
An example of your code in a jsfiddle would be more helpful to answer your question.
Upvotes: 1