Skip to content

Commit 4fccb01

Browse files
committed
removed width and panelWidth option
1 parent 6dbbfab commit 4fccb01

9 files changed

+317
-104
lines changed

README.markdown

+26-66
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,32 @@
1010

1111
(Only the most recent changes are shown below, see the [wiki page](https://github.com/chriscoyier/MovingBoxes/wiki/Change-Log) for a complete listing)
1212

13+
###Version 2.2.2 (1/3/2012)
14+
15+
* Removed the `width` and `panelWidth` options.
16+
* The width and panel width are now set using css
17+
* The plugin is still backwards compatible, so setting the `width` and `panelWidth` in the option will still override the css settings.
18+
* Updated the `movingboxes.css` with the following css:
19+
20+
``css
21+
/* Default MovingBoxes wrapper size */
22+
#movingboxes {
23+
width: 900px;
24+
min-height: 200px;
25+
}
26+
27+
/* Default MovingBoxes panel size */
28+
#movingboxes > li {
29+
width: 350px;
30+
}
31+
```
32+
33+
* So, the width still **should not** be set to a percentage, e.g. `width: 100%`, because it will not update when the window resizes.
34+
* Here is [a demo](http://jsfiddle.net/Mottie/jMXx3/1/) of how to resize the slider on the fly.
35+
* Please note that the overall width can now be much much wider than the panel, so please **DON'T use the `wrap` option** in this case because it just doesn't look good.
36+
* Fixed for [issue #49](https://github.com/chriscoyier/MovingBoxes/issues/49).
37+
* The `completed` callback will no longer run immediately after initialization. Fix for [issue #57](https://github.com/chriscoyier/MovingBoxes/issues/57).
38+
1339
###Version 2.2.1 (11/10/2011)
1440
* Clicking on panels will now work properly. Fix for [issue #44](https://github.com/chriscoyier/MovingBoxes/issues/44).
1541
@@ -49,69 +75,3 @@
4975
5076
###Version 2.0.4 (5/7/2011)
5177
* Fixed hash tags which apparently broke in the last version =/
52-
53-
###Version 2.0.3 (4/22/2011)
54-
* Adjusted width of MovingBoxes internal wrapper to fix [issue #24](https://github.com/chriscoyier/MovingBoxes/issues/24).
55-
* Restructured the plugin to allow updating MovingBoxes after adding or removing a panel.
56-
* To use, simply call the plugin a second time without any options: `$('.slider').movingBoxes();`
57-
* These new changes now require a minimum of jQuery version 1.4.2 (due to the use of "delegate()").
58-
* Restructured the layout of MovingBoxes.
59-
* Previously, two divs were wrapped inside of the element the MovingBoxes plugin was called on. The structure was like this: #slider-one.movingBoxes.mb-slider > DIV.mb-scroll > DIV.mb-scrollContainer > .mb-panel.
60-
* It worked, but when the element was a UL it became poorly formed HTML, because it added two divs inside the UL which wrapped all of the LI's.
61-
* This restructuring actually only required minor changes to the css: `.mb-slider` is no longer the overall wrapper, it was renamed to `.mb-wrapper` and `.mb-scrollContainer` was renamed to `.mb-slider`
62-
* The new layout is DIV.movingBoxes.mb-wrapper > DIV.mb-scroll > #slider-one.mb-slider > .mb-panel
63-
* When accessing the plugin object, you will still target the .mb-slider. So the methods, events & callbacks didn't change at all. You may not even notice a difference, unless you modified the css for your theme.
64-
* Modified the plugin so that instead of using the `currentPanel()` function to set the current panel, you can just call the plugin with a number (shortcut method). Both of these methods do the same thing:
65-
* `$('.slider').data('movingBoxes').currentPanel(2, function(){ alert('done!'); });`
66-
* `$('.slider').movingBoxes(2, function(){ alert('done!'); });`
67-
68-
###Version 2.0.2 (4/8/2011)
69-
* Changed default box shadow to be "inset".
70-
* Added a separate IE stylesheet for versions < 9. Older IE versions will use a background image to add an inner shadow. It is using a png file, so it may not work properly in all older versions.
71-
72-
###Version 2.0.1 (3/31/2011)
73-
* Added more width to the scroll container. Fix for [issue #19](https://github.com/chriscoyier/MovingBoxes/issues/19).
74-
* Centered the image... silly css problem. Fix for [issue #20](https://github.com/chriscoyier/MovingBoxes/issues/20).
75-
* Moving boxes will no longer scroll when using the space bar or arrow keys inside an input, selector or textarea. Fix for [issue #22](https://github.com/chriscoyier/MovingBoxes/issues/22).
76-
77-
###Version 2.0 (3/11/2011)
78-
* Made all css class name more unique by adding a "mb-" in front. Fix for [issue #15](https://github.com/chriscoyier/MovingBoxes/issues/15).
79-
* Removed font-size animation, and set percentage font sizes in the css. This reduces the amount of scripting and speeds up the script. CSS comments added to make these changes more clear.
80-
* Removed `panelTitle` and `panelText` options as these sizes are now controlled as percentages in the CSS.
81-
* Removed `panels` class name from HTML markup. It is now `mb-panels` and automatically added by the script.
82-
* Added `panelType` option. This is the jQuery selector used to find the panels.
83-
84-
* The default value is "> div" which means target the immediate children (">") only if they are divs "div".
85-
* For example, the first demo is now an unordered list (ul#slider-one &amp; li) with it's `panelType` set to "> LI" (the immediate childen of the UL).
86-
* The second demo example has divs inside of a div#slider-two. So `panelType` is not set in the options.
87-
* If the ">" (immediate children selector) is not used, any panels that have matching elements ("LI" within a list inside the panel) will also be targeted and likely break the MovingBoxes appearance.
88-
* If there are any issues with panels not being found, then set `panelType` to something like ".myPanel", then just add the "myPanel" class to panel.
89-
90-
* Added a "movingBoxes" namespace to all events
91-
92-
* The triggered events are now as follows: `initialized.movingBoxes`, `initChange.movingBoxes`, `beforeAnimation.movingBoxes` and `completed.movingBoxes`.
93-
* The "tar" event variable is now available in all events (it wasn't included in the `initialized` and `completed` events before).
94-
* Use it as follows:
95-
96-
$('#slider').bind('completed.movingBoxes', function(e, slider, tar){
97-
// e.type = "completed", e.namespace = "movingBoxes"
98-
// tar = target panel# which is the same as current panel (slider.curPanel) when "completed" event is called
99-
alert('Now on panel #' + slider.curPanel);
100-
});
101-
102-
* Note that the callback names haven't changed (don't add a ".movingBoxes" to the end when adding the callback name in the initialization options.
103-
104-
$('#slider').movingBoxes({
105-
// tar = target panel# which is the same as current panel (slider.curPanel) when "completed" event is called
106-
completed : function(e, slider, tar) { alert('now on panel ' + tar); }
107-
})
108-
109-
* Added a "slider" variable to the set method callback:
110-
111-
// returns panel#, scrolls to 2nd panel, then runs callback function
112-
// panel also contains the current slide #, but it's not accessible inside the callback
113-
var panel = $('.slider').data('movingBoxes').currentPanel(2, function(slider){
114-
alert('done! now on slide #' + slider.curPanel); // callback
115-
});
116-
117-
* Fixed a problem in Opera where the top half of the panel would be out of view.

basic.html

+11-3
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,21 @@
1616

1717
<!-- Demo only -->
1818
<link href="demo/demo.css" media="screen" rel="stylesheet">
19+
<style>
20+
/* Dimensions set via css in MovingBoxes version 2.2.2+ */
21+
#slider { width: 500px; }
22+
#slider li { width: 250px; }
23+
</style>
1924
<script>
2025
$(function(){
2126

2227
$('#slider').movingBoxes({
28+
/* width and panelWidth options deprecated, but still work to keep the plugin backwards compatible
29+
width: 500,
30+
panelWidth: 0.5,
31+
*/
2332
startPanel : 1, // start with this panel
24-
width : 300, // overall width of movingBoxes (not including navigation arrows)
25-
wrap : true, // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
33+
wrap : false, // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
2634
buildNav : true, // if true, navigation links will be added
2735
navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
2836
});
@@ -41,7 +49,7 @@
4149
<div id="nav">
4250
<a href="index.html">Main Demo</a>
4351
<a class="current" href="basic.html">Basic Demo</a>
44-
<a class="play" href="http://jsfiddle.net/Mottie/SnjC4/">Playground</a>
52+
<a class="play" href="http://jsfiddle.net/Mottie/jMXx3/">Playground</a>
4553
<a class="git" href="https://github.com/chriscoyier/MovingBoxes/wiki">Documentation</a>
4654
<a class="git" href="https://github.com/chriscoyier/MovingBoxes/downloads">Download</a>
4755
<a class="issue" href="https://github.com/chriscoyier/MovingBoxes/issues">Issues</a>

css/movingboxes.css

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
/* Default MovingBoxes wrapper size */
2+
#movingboxes {
3+
width: 900px;
4+
min-height: 200px;
5+
}
6+
7+
/* Default MovingBoxes panel size */
8+
#movingboxes > li {
9+
width: 350px;
10+
}
11+
112
/*** Overall MovingBoxes Slider ***/
213
.mb-wrapper {
3-
width: 900px; /* default, this is overridden by script settings */
4-
min-height: 200px;
514
border: 5px solid #ccc;
615
margin: 0 auto;
716
position: relative;
@@ -37,8 +46,7 @@
3746

3847
/*** Slider panel ***/
3948
.mb-slider .mb-panel {
40-
width: 350px; /* default, this is overridden by script settings */
41-
margin: 5px 0;
49+
margin: 0;
4250
padding: 5px;
4351
display: block;
4452
cursor: pointer;

demo/demo.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,27 @@ $(function(){
66

77
$('#slider-one').movingBoxes({
88
startPanel : 1, // start with this panel
9-
width : 300, // overall width of movingBoxes (not including navigation arrows)
9+
reducedSize : 0.8, // non-current panel size: 80% of panel size
1010
wrap : true, // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
1111
buildNav : true, // if true, navigation links will be added
1212
navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
13+
14+
// width and panelWidth options removed in v2.2.2, but still backwards compatible
15+
// width : 300, // overall width of movingBoxes (not including navigation arrows)
16+
// panelWidth : 0.5, // current panel width
17+
1318
});
1419

1520
$('#slider-two').movingBoxes({
1621
startPanel : 3, // start with this panel
17-
width : 500, // overall width of movingBoxes (not including navigation arrows)
18-
panelWidth : .7, // current panel width adjusted to 70% of overall width
22+
reducedSize : 0.8, // non-current panel size: 80% of panel size
1923
buildNav : true, // if true, navigation links will be added
2024
navFormatter : function(index, panel){ return panel.find('h2 span').text(); } // function which gets nav text from span inside the panel header
25+
26+
// width and panelWidth options removed in v2.2.2, but still backwards compatible
27+
// width : 500, // overall width of movingBoxes (not including navigation arrows)
28+
// panelWidth : 0.7, // current panel width
29+
2130
});
2231

2332
// Add a slide
@@ -76,15 +85,14 @@ $(function(){
7685
return false;
7786
});
7887

79-
/*
8088
// Report events to firebug console
8189
$('.mb-slider').bind('initialized.movingBoxes initChange.movingBoxes beforeAnimation.movingBoxes completed.movingBoxes',function(e, slider, tar){
8290
// show object ID + event in the firebug console
8391
// namespaced events: e.g. e.type = "completed", e.namespace = "movingBoxes"
84-
if (window.console && window.console.firebug){
92+
if (window.console && window.console.log){
8593
var txt = slider.$el[0].id + ': ' + e.type + ', now on panel #' + slider.curPanel + ', targeted panel is ' + tar;
86-
console.debug( txt );
94+
console.log( txt );
8795
}
8896
});
89-
*/
97+
9098
});

index.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
<!-- Demo only -->
1818
<link href="demo/demo.css" media="screen" rel="stylesheet">
1919
<script src="demo/demo.js"></script>
20+
<style>
21+
/* Overall & panel width defined using css in MovingBoxes version 2.2.2+ */
22+
ul#slider-one { width: 300px; }
23+
ul#slider-one > li { width: 150px; }
24+
div#slider-two { width: 500px; }
25+
div#slider-two > div { width: 360px; }
26+
</style>
27+
<script>
28+
29+
</script>
2030
</head>
2131
<body>
2232

@@ -28,7 +38,7 @@
2838
<div id="nav">
2939
<a class="current" href="index.html">Main Demo</a>
3040
<a href="basic.html">Basic Demo</a>
31-
<a class="play" href="http://jsfiddle.net/Mottie/SnjC4/">Playground</a>
41+
<a class="play" href="http://jsfiddle.net/Mottie/jMXx3/">Playground</a>
3242
<a class="git" href="https://github.com/chriscoyier/MovingBoxes/wiki">Documentation</a>
3343
<a class="git" href="https://github.com/chriscoyier/MovingBoxes/downloads">Download</a>
3444
<a class="issue" href="https://github.com/chriscoyier/MovingBoxes/issues">Issues</a>

0 commit comments

Comments
 (0)