-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
129 lines (121 loc) · 3.7 KB
/
demo.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Convert To Background - Demo</title>
<style>
body {
margin: 0;
font-family: sans-serif;
}
img {
max-width: 100%;
height: auto;
}
.wrapper {
max-width: 1070px;
padding-left: 20px;
padding-right: 20px;
margin-left: auto;
margin-right: auto;
padding: 50px 20px;
}
.row:before,
.row:after {content:'.';display:block;overflow:hidden;visibility:hidden;font-size:0;line-height:0;width:0;height:0}
.row:after {clear:both}
.left {
float: left;
width: 47%;
}
.right {
float: right;
width: 47%;
}
.back-to-gh {
margin-top: 50px;
}
section {
padding: 25px 0px;
}
</style>
</head>
<body>
<div class="wrapper">
<h1>Convert To Background - Demo</h1>
<section class="not-responsive">
<h2>Demo: Not Responsive</h2>
<p>If plugin's 'responsive' property is not enabled, the element will <strong>not</strong> maintain its aspect ratio on resize.</p>
<div class="row">
<div class="left">
<h4>Original</h4>
<img src="https://via.placeholder.com/500x250" alt="">
</div>
<div class="right">
<h4>After Converting</h4>
<div class="element-that-has-image">
<img src="https://via.placeholder.com/500x250" alt="">
</div>
</div>
</div>
<div class="row">
<div class="left">
<h4>Normal Image Tag</h4>
<img src="https://via.placeholder.com/250x250" alt="">
</div>
<div class="right">
<h4>After Converting</h4>
<div class="element-that-has-image">
<img src="https://via.placeholder.com/250x250" alt="">
</div>
</div>
</div>
</section>
<section class="responsive">
<h2>Demo: Responsive</h2>
<p>If plugin's 'responsive' property is not enabled, the element will maintain its aspect ratio on resize like a normal image.</p>
<div class="row">
<div class="left">
<h4>Original</h4>
<img src="https://via.placeholder.com/500x250" alt="">
</div>
<div class="right">
<h4>After Converting</h4>
<div class="responsive-image">
<img src="https://via.placeholder.com/500x250" alt="">
</div>
</div>
</div>
<div class="row">
<div class="left">
<h4>Normal Image Tag</h4>
<img src="https://via.placeholder.com/250x250" alt="">
</div>
<div class="right">
<h4>After Converting</h4>
<div class="responsive-image">
<img src="https://via.placeholder.com/250x250" alt="">
</div>
</div>
</div>
</section>
<p class="back-to-gh"><a href="https://github.com/zeshanshani/jquery-convert-to-background/">Back To Github</a></p>
</div>
</body>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>
<script src="jquery.convertToBackground.js"></script>
<script>
// Non responsive image
$('.element-that-has-image').convertToBackground({
width: 250,
height: 250,
});
// Responsive image
$('.responsive-image').convertToBackground({
width: 250,
height: 250,
responsive: true
});
</script>
</html>