This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, PropTypes } from 'react'; | |
import withStyles from 'isomorphic-style-loader/lib/withStyles'; | |
import s from './ProgressBar.scss'; | |
class ProgressBar extends Component { | |
render() { | |
const {completed} = this.props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var items = "", | |
data = ["your json data"] | |
$.each(json, function(i, item){ | |
items += data[i] ; // simplest example | |
}); | |
// this is fine because a .each is synchronous and doesn't need a callback | |
$('[data-json-container]').append(items); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$list = $('.collections__list'); | |
$item = $list.find('.list__item--is-selected'); | |
$prev = $item.prev(); | |
$prepended = false; | |
if ($(window).width() < 700 && $item.index() != 0 && !prepended) { | |
$list.prependTo('.collections__list'); | |
prepended = true; | |
} | |
else if ($(window).width() > 700 && prepended) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Nice way, using matchMedia, no IE9 or below support | |
var media = "screen and (min-width: 720px)", | |
placeholderShort = "Short holder", | |
placeholderLong = "My quite long placeholder"; | |
$(window).resize(function(){ | |
if(window.matchMedia(media).matches) { | |
$('.element').attr('placeholder', placeholderLong); | |
} | |
else { | |
$('.element').attr('placeholder', placeholderShort); |
NewerOlder