Skip to content

Commit af7ce98

Browse files
committed
content non-specific resizing
1 parent 2de0ec4 commit af7ce98

16 files changed

+151
-137
lines changed

README.markdown

+15-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,24 @@
99

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

12+
###Version 2.1 (6/10/2011)
13+
* The script now prevents changing slides before it completes initialization. Fix for [issue #29](https://github.com/chriscoyier/MovingBoxes/issues/29).
14+
* Removed element specific resizing:
15+
* Removed `imageRatio` option. Set the image using a percentage width and it will adjust the height automatically to maintain the image's aspect ratio.
16+
* In the script, the portion which set the height of images was removed. So now all panel content is set using css percentage values (or "em" for font sizes).
17+
* Moved CSS, including `.mb-inside img {}` to the demo.css since the layout now allows images of any size inside the panels. The dimensions should now be set in the css using a percentage value.
18+
* MovingBoxes will update a second time once the page has completely loaded. This now causes a vertical height resizing animation in webkit browsers. One way to work around this is to set the image height of the "current" panel - see the demo.css file.
19+
* Removed `panelType` options as the script now automatically looks for immediate children of the initialized element. You shouldn't even notice a difference.
20+
* Moved all demo related files into a demo folder.
21+
1222
###Version 2.0.5 (6/9/2011)
13-
* Fixed margins when MovingBoxes gets updated. Fix for issue #30.
23+
* Fixed margins when MovingBoxes gets updated. Fix for [issue #30](https://github.com/chriscoyier/MovingBoxes/issues/30).
1424

1525
###Version 2.0.4 (5/7/2011)
1626
* Fixed hash tags which apparently broke in the last version =/
1727

1828
###Version 2.0.3 (4/22/2011)
19-
* Adjusted width of MovingBoxes internal wrapper to fix issue #24.
29+
* Adjusted width of MovingBoxes internal wrapper to fix [issue #24](https://github.com/chriscoyier/MovingBoxes/issues/24).
2030
* Restructured the plugin to allow updating MovingBoxes after adding or removing a panel.
2131
* To use, simply call the plugin a second time without any options: `$('.slider').movingBoxes();`
2232
* These new changes now require a minimum of jQuery version 1.4.2 (due to the use of "delegate()").
@@ -35,9 +45,9 @@
3545
* 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.
3646

3747
###Version 2.0.1 (3/31/2011)
38-
* Added more width to the scroll container. Fix for issue #19.
39-
* Centered the image... silly css problem. Fix for issue #20.
40-
* Moving boxes will no longer scroll when using the space bar or arrow keys inside an input, selector or textarea. Fix for issue #22.
48+
* Added more width to the scroll container. Fix for [issue #19](https://github.com/chriscoyier/MovingBoxes/issues/19).
49+
* Centered the image... silly css problem. Fix for [issue #20](https://github.com/chriscoyier/MovingBoxes/issues/20).
50+
* 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).
4151

4252
###Version 2.0 (3/11/2011)
4353
* Made all css class name more unique by adding a "mb-" in front. Fix for [issue #15](https://github.com/chriscoyier/MovingBoxes/issues/15).

css/demo.css

-31
This file was deleted.

css/movingboxes.css

+3-27
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
width: 350px; /* default, this is overridden by script settings */
4040
margin: 5px 0;
4141
padding: 5px;
42+
display: block;
4243
cursor: pointer;
4344
float: left;
4445
list-style: none;
@@ -56,33 +57,8 @@
5657
border: 1px solid #999;
5758
}
5859

59-
.mb-inside img {
60-
display: block;
61-
border: 1px solid #666;
62-
margin: 0 auto;
63-
width: 100%;
64-
}
65-
66-
.mb-inside h2 {
67-
font-weight: normal;
68-
color: #000;
69-
font-size: 140%; /* Adjust panel header font size using em or % */
70-
margin: 0 0 8px 0;
71-
}
72-
73-
.mb-inside p {
74-
font-size: 100%; /* Adjust panel text font size using em or % */
75-
color: #444;
76-
}
77-
78-
.mb-inside a {
79-
color: #333;
80-
text-decoration: none;
81-
border-bottom: 1px dotted #ccc;
82-
}
83-
84-
.mb-inside a:hover {
85-
border-bottom: 1px solid #999;
60+
.mb-inside * {
61+
max-width: 100%;
8662
}
8763

8864
/*** Left & Right Navigation Arrows ***/

images/1.jpg demo/1.jpg

File renamed without changes.

images/2.jpg demo/2.jpg

File renamed without changes.

images/3.jpg demo/3.jpg

File renamed without changes.

images/4.jpg demo/4.jpg

File renamed without changes.

images/5.jpg demo/5.jpg

File renamed without changes.

images/6.jpg demo/6.jpg

File renamed without changes.

images/7.jpg demo/7.jpg

File renamed without changes.

demo/demo.css

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* Moving Boxes demo CSS */
2+
* {
3+
margin: 0;
4+
padding: 0;
5+
}
6+
7+
body {
8+
font: 11px Helvetica, Arial, sans-serif;
9+
}
10+
11+
#wrapper {}
12+
13+
/* Moving Boxes title image wrapper */
14+
#title {
15+
text-align: center;
16+
}
17+
#title img {
18+
border: 0;
19+
}
20+
21+
/* panel images */
22+
.mb-inside img {
23+
width: 100%;
24+
}
25+
26+
27+
#slider-two .current img {
28+
/* height of the placeholder until image completely loads - needed for
29+
webkit browsers, add this only if you don't want the height animation
30+
on startup.
31+
32+
326px measures the height of the current image when enlarged
33+
34+
height: 326px;
35+
36+
*/
37+
}
38+
39+
/* panel links */
40+
.mb-inside a {
41+
color: #333;
42+
text-decoration: none;
43+
border-bottom: 1px dotted #ccc;
44+
}
45+
.mb-inside a:hover {
46+
border-bottom: 1px solid #999;
47+
}
48+
49+
/* Add/remove panels buttons */
50+
.buttons {
51+
padding: 5px 10px;
52+
text-align: center;
53+
}
54+
55+
/* direct link styling */
56+
.dlinks {
57+
text-align: center;
58+
font-size: 20px;
59+
}

js/demo.js demo/demo.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,29 @@ $(function(){
77
$('#slider-one').movingBoxes({
88
startPanel : 4, // start with this panel
99
width : 300, // overall width of movingBoxes (not including navigation arrows)
10-
imageRatio : 1, // Image ration set to 1:1 (square image)
1110
wrap : true, // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
1211
buildNav : true, // if true, navigation links will be added
13-
panelType : '> li', // selector to find the immediate ">" children "li" of "#slider-one" in this case
1412
navFormatter : function(){ return "&#9679;"; } // function which returns the navigation text for each panel
1513
});
1614

1715
$('#slider-two').movingBoxes({
1816
startPanel : 3, // start with this panel
19-
width : 600, // overall width of movingBoxes (not including navigation arrows)
17+
width : 650, // overall width of movingBoxes (not including navigation arrows)
2018
panelWidth : .7, // current panel width adjusted to 70% of overall width
21-
imageRatio : 16/9, // Image ratio set to 16:9
2219
buildNav : true, // if true, navigation links will be added
2320
navFormatter : function(index, panel){ return panel.find('h2 span').text(); } // function which gets nav text from span inside the panel header
2421
});
2522

2623
// Add a slide
27-
var imageNumber = 1,
28-
panel = '<li><img src="images/*.jpg" alt="picture" /><h2>News Heading #*</h2><p>A very short exerpt goes here... <a href="#">more</a></p></li>',
24+
var imageNumber = 0,
25+
panel = '<li><img src="demo/*1.jpg" alt="picture" /><h2>News Heading #*2</h2><p>A very short exerpt goes here... <a href="#">more</a></p></li>',
2926
// to test adding/removing panels to the second slider, comment out the line above and uncomment out the line below - slider-two uses divs instead of UL & LIs
3027
// panel = '<div><img src="images/*.jpg" alt="picture" /><h2>News Heading #<span>*</span></h2><p>A very short exerpt goes here... <a href="#">more</a></p></div>',
3128
slider = $('#slider-one'); // $('#slider-two'); // second slider
3229

3330
$('button.add').click(function(){
3431
slider
35-
.append(panel.replace(/\*/g, (++imageNumber%7 + 1)))
32+
.append( panel.replace(/\*2/g, ++imageNumber).replace(/\*1/g, (imageNumber%7 + 1)) )
3633
.movingBoxes(); // update movingBoxes
3734
});
3835

File renamed without changes.

index.html

+28-28
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
<![endif]-->
1414

1515
<!-- Required script -->
16-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" charset="utf-8"></script>
16+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" charset="utf-8"></script>
1717
<script type="text/javascript" src="js/jquery.movingboxes.js" charset="utf-8"></script>
1818

1919
<!-- Demo only -->
20-
<link type="text/css" href="css/demo.css" media="screen" charset="utf-8" rel="stylesheet" />
21-
<script type="text/javascript" src="js/demo.js"></script>
20+
<link type="text/css" href="demo/demo.css" media="screen" charset="utf-8" rel="stylesheet" />
21+
<script type="text/javascript" src="demo/demo.js"></script>
2222
</head>
2323

2424
<body>
2525
<div id="wrapper">
2626
<div id="title">
27-
<a href="http://github.com/chriscoyier/MovingBoxes"><img src="images/movingboxes.png" alt="moving boxes" /></a>
27+
<a href="http://github.com/chriscoyier/MovingBoxes"><img src="demo/movingboxes.png" alt="moving boxes" /></a>
2828
</div>
2929

3030
<br><br>
@@ -43,45 +43,45 @@
4343
<ul id="slider-one">
4444

4545
<li>
46-
<img src="images/1.jpg" alt="picture" />
46+
<img src="demo/1.jpg" alt="picture" />
4747
<h2>News Heading</h2>
48-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/justbcuz/112479862/">more</a></p>
48+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/justbcuz/112479862/">more</a></p>
4949
</li>
5050

5151
<li>
52-
<img src="images/2.jpg" alt="picture" />
52+
<img src="demo/2.jpg" alt="picture" />
5353
<h2>News Heading</h2>
54-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/joshuacraig/2698975899/">more</a> and a whole lot more text goes here, so we can see the height adjust.</p>
54+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/joshuacraig/2698975899/">more</a> and a whole lot more text goes here, so we can see the height adjust.</p>
5555
</li>
5656

5757
<li>
58-
<img src="images/3.jpg" alt="picture" />
58+
<img src="demo/3.jpg" alt="picture" />
5959
<h2>News Heading</h2>
60-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/ruudvanleeuwen/468309897/">more</a></p>
60+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/ruudvanleeuwen/468309897/">more</a></p>
6161
</li>
6262

6363
<li>
64-
<img src="images/4.jpg" alt="picture" />
64+
<img src="demo/4.jpg" alt="picture" />
6565
<h2>News Heading</h2>
66-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/emikohime/294092478/">more</a></p>
66+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/emikohime/294092478/">more</a></p>
6767
</li>
6868

6969
<li>
70-
<img src="images/5.jpg" alt="picture" />
70+
<img src="demo/5.jpg" alt="picture" />
7171
<h2>News Heading</h2>
72-
<p>A very short exerpt goes here... <a href="http://www.flickr.com/photos/fensterbme/499006584/">more</a></p>
72+
<p>Add a short exerpt here... <a href="http://www.flickr.com/photos/fensterbme/499006584/">more</a></p>
7373
</li>
7474

7575
<li>
76-
<img src="images/6.jpg" alt="picture" />
76+
<img src="demo/6.jpg" alt="picture" />
7777
<h2>News Heading</h2>
78-
<p>A very short exerpt goes here... <a href="#">more</a></p>
78+
<p>Add a short exerpt here... <a href="#">more</a></p>
7979
</li>
8080

8181
<li>
82-
<img src="images/7.jpg" alt="picture" />
82+
<img src="demo/7.jpg" alt="picture" />
8383
<h2>News Heading</h2>
84-
<p>A very short exerpt goes here... <a href="#">more</a></p>
84+
<p>Add a short exerpt here... <a href="#">more</a></p>
8585
</li>
8686

8787
</ul> <!-- end Slider #1 -->
@@ -92,33 +92,33 @@ <h2>News Heading</h2>
9292
<div id="slider-two">
9393

9494
<div>
95-
<img src="images/5.jpg" alt="picture" />
95+
<img src="demo/5.jpg" alt="picture" />
9696
<h2>News Heading - <span>Lisa</span></h2>
97-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/fensterbme/499006584/">more</a></p>
97+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/fensterbme/499006584/">more</a></p>
9898
</div>
9999

100100
<div>
101-
<img src="images/4.jpg" alt="picture" />
101+
<img src="demo/4.jpg" alt="picture" />
102102
<h2>News Heading - <span>Monica</span></h2>
103-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/emikohime/294092478/">more</a></p>
103+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/emikohime/294092478/">more</a></p>
104104
</div>
105105

106106
<div>
107-
<img src="images/3.jpg" alt="picture" />
107+
<img src="demo/3.jpg" alt="picture" />
108108
<h2>News Heading - <span>Lin</span></h2>
109-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/ruudvanleeuwen/468309897/">more</a></p>
109+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/ruudvanleeuwen/468309897/">more</a></p>
110110
</div>
111111

112112
<div>
113-
<img src="images/2.jpg" alt="picture" />
113+
<img src="demo/2.jpg" alt="picture" />
114114
<h2>News Heading - <span>Shiela</span></h2>
115-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/joshuacraig/2698975899/">more</a></p>
115+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/joshuacraig/2698975899/">more</a></p>
116116
</div>
117117

118118
<div>
119-
<img src="images/1.jpg" alt="picture" />
119+
<img src="demo/1.jpg" alt="picture" />
120120
<h2>News Heading - <span>Joanne</span></h2>
121-
<p>A very short exerpt goes here... <a href="http://flickr.com/photos/justbcuz/112479862/">more</a></p>
121+
<p>Add a short exerpt here... <a href="http://flickr.com/photos/justbcuz/112479862/">more</a></p>
122122
</div>
123123

124124
</div>

0 commit comments

Comments
 (0)