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
220N/A <a href="scrollview-horiz-example.html" target="_blank" class="button">
220N/A<p>In this example, we'll create a ScrollView instance, which scrolls horizontally, as opposed to the vertically scrolling ScrollView we created in the <a href="scrollview.html">ScrollView With Scroll Indicator</a> example.</p>
220N/A<p>The code for the example is pretty much the same as the code for the <a href="scrollview.html">ScrollView With Scroll Indicator</a> example. The only difference is that instead of having a ScrollView with a fixed height (and content which overflows that height), we set up a ScrollView with a fixed width (and content which overflows that width).</p>
220N/A<p>Since we want to use the base ScrollView, along with the ScrollViewScrollbars plugin, we use the `scrollview` module as we did for the vertical ScrollView example:</p>
<p>As with the vertical <a href="scrollview.html">ScrollView</a> example, we provide the markup for the ScrollView content on the page, as shown below:</p>
<p>But this time, when we instantiate the ScrollView instance, we provide a fixed width, as opposed to a fixed height, for the widget.</p>
var scrollView = new Y.ScrollView({
<p>This causes the list content (which has inline-block applied to each LI by the scrollview CSS) to be wider than the ScrollView, forcing horizontal scrolling. The height of the ScrollView in this case is driven by the height of it's content. As with the ScrollView Base example, we constrain flick handling to a specific axis, in this case the "x" axis.</p>
<p>The important CSS for the example, which switches the LIs to layout horizontally, is shown below, along with some tweaks requires for IE 6 and 7 support:</p>
<p><strong>NOTE:</strong> In the initial ScrollView release (3.2.0), the above CSS to layout LIs horizontally was bundled with the ScrollView CSS out-of-the-box. It has been removed as of the 3.3.0 release, since it makes it harder for developers to nest lists inside the ScrollView content, and in general, ScrollView is content agnostic.</p>
<p>In this example, since we have images which act as drag/flick targets, we need to stop the default image drag/drop behavior in certain browsers (for example gecko and IE), by preventing default on the underlying mousedown event. If we don't prevent default, the image will be natively draggable by default, and interfere with scrolling:</p>
content.delegate("mousedown", function(e) {