Skip to content
Toothbrush edited this page Aug 3, 2015 · 7 revisions

Backbone.js

q: We have a problem with setting value to materialize input on page loading. We use backbone as js mvc framework. And found out that materialize adds active class for input with value on document.ready But we set value to input not in document.ready as it's done inside materialize.js

a: Regarding issue I've posted yesterday we added workaround with setting active class in backbone onShow event

input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea, .datepicker';

rootEl.find(input_selector).each(function(index, element) {
    if (element.value.length) {
        $(this).siblings('label, i').addClass('active');
    }
});

by borodaalex

Center pagination

.flex-center {
    display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */
    display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
    display: -ms-flexbox;      /* TWEENER - IE 10 */
    display: -webkit-flex;     /* NEW - Chrome */
    display: flex;             /* NEW, Spec - Opera 12.1, Firefox 20+ */
    align-items: center;
    -webkit-align-items: center; /* Safari 7.0+ */
    justify-content: center;
    -webkit-justify-content: center; /* Safari 6.1+ */
}

by natham and iHits

Clone this wiki locally