blob: cf5b49011d8cf9f5b5338140255fab984db295a0 (
plain)
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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="../../css/drop.css" />
<link rel="stylesheet" href="../resources/css/base.css" />
<link rel="stylesheet" href="chosen.css" />
</head>
<body>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
<br/>
Favorite pizza style: <br/>
<div class="drop-chosen-target chosen-container chosen-container-single chosen-with-drop" style="width: 350px">
<a class="chosen-single chosen-default" tabindex="-1"><span>Choose a style...</span><div><b></b></div></a>
</div>
<br/>
<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
text<br/>
<script src="../resources/js/log.js"></script>
<script src="../resources/js/jquery.js"></script>
<script src="chosen.js"></script>
<script src="../../drop.js"></script>
<script>
$(function(){
var $target, $drop;
$target = $('.drop-chosen-target').drop({
className: 'drop-chosen',
attach: 'bottom-left',
content: ''
});
$drop = $target.data().drop.$drop;
$drop.append('<select><option>Plain</option><option>Pepperoni</option><option>Supreme</option></select>');
$drop.on('openDrop', function(event){
$target.addClass('chosen-container-active');
}).on('closeDrop', function(event){
$target.removeClass('chosen-container-active');
});
$drop.on('openDrop', function(event) {
var $select = $drop.find('select');
if (!$drop.find('.chosen-container').length) {
$select
.css('width', $target.outerWidth())
.chosen({
allow_single_deselect: true,
disable_search_threshold: 0
})
;
}
setTimeout(function(){
$drop.find('.chosen-search input').click().focus().keyup();
$target.drop('positionDrop');
}, 0);
});
});
</script>
<style>
.drop-chosen-target > a {
outline: none;
}
.drop.drop-chosen {
background: transparent;
}
.drop.drop-chosen .chosen-container > .chosen-single {
display: none;
}
.drop.drop-chosen .chosen-container .chosen-drop {
position: static;
}
</style>
</body>
</html>
|