-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmd-avatar.html
45 lines (40 loc) · 1 KB
/
md-avatar.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../jquery-extensions/jquery-extensions.html">
<style>
md-avatar{
position:relative;
}
</style>
<dom-module id="md-avatar">
<template>
<img class="avatar">
<content></content>
</template>
</dom-module>
<script>
Polymer({
is: 'md-avatar',
properties: {
defaultUrl:{
type:String,
value:null
},
src: {
type: String,
value: null
},
dataClass: {
type: String,
value: null
}
},
ready: function () {
var src=this.src;
var defaultUrl=this.defaultUrl;
var img=$(this).find('.avatar');
if(src)img.attr('src',src);
else if(defaultUrl) img.attr('src',defaultUrl);
if(this.dataClass) img.addClass(this.dataClass);
}
});
</script>