<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Flickity Archives - rweber.net</title>
	<atom:link href="https://www.rweber.net/tag/flickity/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.rweber.net/tag/flickity/</link>
	<description>trying to be a mile wide AND a mile deep</description>
	<lastBuildDate>Sun, 09 Dec 2018 13:50:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">37896774</site>	<item>
		<title>Troubleshooting Flickity: one note</title>
		<link>https://www.rweber.net/javascript/troubleshooting-flickity-one-note/</link>
					<comments>https://www.rweber.net/javascript/troubleshooting-flickity-one-note/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 24 Aug 2015 12:00:56 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Flickity]]></category>
		<category><![CDATA[images]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=39155</guid>

					<description><![CDATA[<div><img width="300" height="200" src="https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-300x200.jpg" class="attachment-medium size-medium wp-post-image" alt="photo of amusement park height restriction sign" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" fetchpriority="high" srcset="https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-300x200.jpg 300w, https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-150x100.jpg 150w, https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>The key to Flickity is this: everything it is applied to needs to have accurate size beforehand. Here are some cases where that wasn't the case and how I fixed them.</p>
<p>The post <a href="https://www.rweber.net/javascript/troubleshooting-flickity-one-note/">Troubleshooting Flickity: one note</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="200" src="https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-300x200.jpg" class="attachment-medium size-medium wp-post-image" alt="photo of amusement park height restriction sign" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" srcset="https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-300x200.jpg 300w, https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-150x100.jpg 150w, https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>Just a quick note this week. The JavaScript add-on Flickity is fun, but I don&#8217;t always get what I want from it immediately. Here&#8217;s the key I&#8217;ve deduced: everything Flickity is applied to needs to have accurate size beforehand. I&#8217;ve encountered two situations where that was not the case.</p>
<p>The first, explained in my <a href="https://www.rweber.net/web-development/css/gilding-the-gallery-mla-flickity/">MLA + Flickity post</a>, was when max-width: 100% set on images was causing anything not visible at the beginning of the slideshow to be blank &#8211; or, more accurately, zero width.</p>
<p>More recently, I was trying to create a slideshow in a page where most of the content accordion-folds up at mobile size. No applying Flickity with HTML there! If I did, I got one of two outcomes: if I set a height on my images, they all showed up stacked on top of each other. If not, the whole thing was the height of the combined top and bottom padding of the container. I needed to add a distinguishing class, and then set the accordioning code to check whether a panel it had just opened had that class. If so, apply Flickity from the JavaScript at that point. I&#8217;ve had no trouble with repeated opening and closing of the accordion.</p>
<p><strong>Edit 9/30:</strong> In fact yet a third issue has arisen: Flickity not knowing the height of the slideshow because it&#8217;s being applied before the page content is fully loaded. <code>$(document).ready</code> wasn&#8217;t enough; I needed <code>$(window).load(function () { /*call Flickity here*/ });</code><br />
[Edit 12/12/16: .load was deprecated many versions of jQuery ago and finally removed in v3. Try <code>$(window).on("load", function(){});</code>]</p>
<p><strong>Edit 2/23/16:</strong> I don&#8217;t know the reason for the conflict as of this writing, but I&#8217;ve since discovered that Flickity does not get along with CSS columns. With <code>overflow: hidden;</code> set on .flickity-viewport no images show, and with it removed, some images show outside of the viewport.</p>
<p>I hope this helps someone!</p>
<p><small>You Must Be This Tall to Ride from Eric Mesa via <a href="https://www.flickr.com/photos/ericsbinaryworld/4744428334">Flickr</a>.</small></p>
<p>The post <a href="https://www.rweber.net/javascript/troubleshooting-flickity-one-note/">Troubleshooting Flickity: one note</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/javascript/troubleshooting-flickity-one-note/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">39155</post-id>	</item>
		<item>
		<title>Gilding the Gallery: MLA + Flickity</title>
		<link>https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/</link>
					<comments>https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 23 Mar 2015 12:00:24 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP and MySQL]]></category>
		<category><![CDATA[Fancy Fifteen]]></category>
		<category><![CDATA[Flickity]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress gallery]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=37349</guid>

					<description><![CDATA[<p>Applying the JavaScript carousel program Flickity to a WordPress gallery, or more properly a Media Library Assistant gallery, for responsiveness and easy updating.</p>
<p>The post <a href="https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/">Gilding the Gallery: MLA + Flickity</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve done a lot of looking at gallery/slider/carousel plugins for WordPress, and haven&#8217;t been terribly enthusiastic about the selection. Very few interface directly with the WP Media Library, for instance, or allow easy categorization/photo album structure, and the responsiveness situation isn&#8217;t inspiring. Time to roll my own.</p>
<p><b>Edit:</b> Since I have made so many additions to Twenty Fifteen, I thought it would be useful to assemble them into a single child theme. You can see the <a href="https://github.com/ReveWeber/fancyfifteen">Fancy Fifteen code on GitHub</a>, or look at <a href="https://www.rweber.net/tag/fancyfifteen/">all posts here tagged fancyfifteen</a>.</p>
<p><a href="https://www.rweber.net/wp-content/uploads/2015/03/gallery-screenshot.png"><img decoding="async" src="https://www.rweber.net/wp-content/uploads/2015/03/gallery-screenshot.png" alt="screenshot of carousel built with flickity.js and the WordPress plugin Media Library Assistant" width="792" height="468" class="aligncenter size-full wp-image-37466" srcset="https://www.rweber.net/wp-content/uploads/2015/03/gallery-screenshot.png 792w, https://www.rweber.net/wp-content/uploads/2015/03/gallery-screenshot-300x177.png 300w" sizes="(max-width: 792px) 100vw, 792px" /></a></p>
<p>The goal here: a front page carousel that could be easily updated, with just half a dozen or so selections from the most recent images added to the site. The pictures would be human-chosen. The carousel needed to be responsive and easy to navigate (for everyone; i.e., accessible), and ideally the whole shebang could coordinate with a filterable photo gallery to be created for the same site.</p>
<p>Enter <a href="https://wordpress.org/plugins/media-library-assistant/">Media Library Assistant</a>. There are two functions of MLA that are important for this use: the addition of taxonomies to media library items directly, and the expansion of WordPress&#8217;s gallery shortcode into mla-gallery, with dynamic selection of media items by taxonomy, user-defined templates (as in direct control of the gallery&#8217;s HTML structure), and many other settings.</p>
<p>I figured I could apply a nice jQuery carousel to an MLA gallery of the correct form, and after looking around, <a href="http://flickity.metafizzy.co/">Flickity</a> seemed like the best candidate (with the implicit recommendation of <a href="https://css-tricks.com/creating-responsive-touch-friendly-carousels-with-flickity/">CSS-Tricks</a>). It is responsive, accessible, well-adapted to mouse/trackpad, keyboard, and touch, and styleable from the theme&#8217;s CSS file. After one significant (but easily remedied) hiccup we were in business!</p>
<p>Here&#8217;s how to set it up. There are some places where I made arbitrary decisions (such as downloading flickity.css but using a CDN for the .js file), but it should be easy to figure out how to make different ones.</p>
<p>For specificity, we&#8217;ll make a child theme to add this functionality to Twenty Fifteen. For now you can see this on my <a href="http://rweber.net/test_site/wordpress/carousel-page/">WordPress test site</a> but there is no guarantee that will continue to be true indefinitely.</p>
<p>style.css:<br />
<script src="https://pastebin.com/embed_js.php?i=DJhJRCEi"></script></p>
<p>Many themes set max-width: 100% on images for responsiveness purposes; it keeps them from exploding out of their housings when the browser gets smaller. However, you have to override it here or the images you can&#8217;t originally see may collapse to width 0. That was the hiccup I referred to &#8211; why is there blank white space when I click through the carousel?!? The last section highlights the gallery if you tab to it so you know you&#8217;ve tabbed to it; it&#8217;s straight off the Flickity website. I set a height of 200px; you can let it be determined by the images by removing that line of CSS and the line setGallerySize: false in carousel.js, below.</p>
<p>carousel.js:<br />
<script src="https://pastebin.com/embed_js.php?i=DzbT6BGc"></script></p>
<p>functions.php:<br />
<script src="https://pastebin.com/embed_js.php?i=PPeeD1LA"></script></p>
<p>Just put flickity.css, carousel.js, functions.php, and style.css (for your child theme) all into a folder called twenty-fifteen-flickity, zip it up, and upload it.</p>
<p>In Settings -> Media Library Assistant -> MLA Gallery (the middle tab), scroll to the bottom and create a template called carousel. Fill in the following boxes:<br />
Open: <code>&lt;div id='carousel-gallery' class='carousel-no-js'></code><br />
Item: <code>&lt;div class='carousel-item'><br />
	[+link+]<br />
&lt;/div></code><br />
Close: <code>&lt;/div></code></p>
<p>In Media -> Assistant, tag all images for the slideshow with &#8220;featured&#8221; (or something else, and then change &#8220;featured&#8221; in the shortcode below).<br />
Where you want the carousel, place the shortcode<br />
<code>[mla_gallery attachment_tag=featured mla_style="none" mla_markup="carousel" size=medium link=full]</code></p>
<p>Some notes:<br />
&#8211; Most everything is adjustable from the CSS file, the MLA shortcode options, or the Flickity options.<br />
&#8211; You&#8217;ll have to add appropriate styling for responsiveness, but no differently from usual.<br />
&#8211; For graceful degradation the images start with the class carousel-no-js and carousel.js replaces that with carousel-js-on; I haven&#8217;t styled .carousel-no-js at all and wouldn&#8217;t count this as finished without doing so, but how to style it is a matter of taste.<br />
&#8211; I threw a lightbox plugin onto the test site as well (Responsive Lightbox by dfactory) and it works without a squawk.</p>
<p>The post <a href="https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/">Gilding the Gallery: MLA + Flickity</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">37349</post-id>	</item>
	</channel>
</rss>
