bjork24 / Unison

Unifying named breakpoints across CSS, JS, and HTML
http://bjork24.github.io/Unison
MIT License
453 stars 41 forks source link

Responsive comment load if smaller than breakpoint #11

Closed shaunmorrison closed 10 years ago

shaunmorrison commented 10 years ago

Now you can specify to load commented content if current screen size is either smaller OR larger than the specified breakpoints. Previously, commented content could only be loaded in if larger than a specified breakpoint.

This is done with the data attribute names in triggerMin (data-usn-load-if-larger) & triggerMax (data-usn-load-if-smaller).

This would load if larger than the specified breakpoint:

<div data-usn-load-if-larger="usn-sml-med">
    <!-- content -->
</div>

This would load if smaller than the specified breakpoint:

<div data-usn-load-if-smaller="usn-sml-med">
    <!-- content -->
</div>

I know the original Responsive Comments JS was created to be 'progressive enhancement only', but often IMHO there is a good reason to load in different content & media on smaller devices.

bjork24 commented 10 years ago

Haven't forgotten about this. I've been thinking about splitting out a max-width version into a plugin, since the original intent was to keep this mobile first. Will give more thought and comment later.

bjork24 commented 10 years ago

Think I'm going to keep this as mobile-first for now. May circle back at a later version, but happy with the implementation as of now.