wordcamp london 2013

17
3 Useful jQuery Libraries

Upload: ivdimova

Post on 16-Jul-2015

689 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: WordCamp London 2013

3 Useful jQuery Libraries

Page 2: WordCamp London 2013

Who am I?

Page 3: WordCamp London 2013

Chosen

Page 4: WordCamp London 2013

Example

$(function () { $('.chosen-select').chosen({ allow_single_deselect: true, placeholder_text_multiple: "Choose a

category..." });});

Page 5: WordCamp London 2013

WordPress

<div id="cats" >

<?php $cats = get_terms('product_cat');?>

<form>

<select style="width:350px;" multiple class="chosen-select">

<?php foreach ($cats as $cat) {?>

<option><?php echo $cat->name;?></option>

<?php } ?>

</select>

</form>

</div>

Page 6: WordCamp London 2013

Showcase

Page 7: WordCamp London 2013

http://harvesthq.github.io/chosen/options.html

Page 8: WordCamp London 2013

Masonry

Page 9: WordCamp London 2013

var $container = $('ul.products');// initialize$container.masonry({ columnWidth: 60, itemSelector: 'li.product', "gutter": 10, "isFitWidth": true

});$container.on( 'click', 'li.product',

function() { $( this ).toggleClass('is-expanded');

$container.masonry(); });

Example

Page 10: WordCamp London 2013

Showcase

Page 11: WordCamp London 2013

http://masonry.desandro.com/options.html

Page 12: WordCamp London 2013

FlexSlider

Page 13: WordCamp London 2013

jQuery('.flexslider').flexslider({ animation: "slide", controlNav: "thumbnails", slideshow: false });

Example

Page 14: WordCamp London 2013

WordPress<?php

$attachments = get_posts( array( 'post_type' => 'attachment', 'post_parent' =>$post->ID));

if ( $attachments ) {

echo '<div class="flexslider"> <ul class="slides">';

foreach ( $attachments as $attachment ) {

$thumb_src = wp_get_attachment_image_src( $attachment->ID, 'slider-thumb' );

echo '<li data-thumb="'. $thumb_src[0] .'">' . wp_get_attachment_image( $attachment->ID, 'slider' ) .

'</li>';

}

echo '</ul> </div>';

} ?>

Page 15: WordCamp London 2013
Page 16: WordCamp London 2013

http://www.woothemes.com/flexslider/

Page 17: WordCamp London 2013