Skip to content

Commit

Permalink
Rework markup creation for more flexibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jsor committed Oct 26, 2010
1 parent bef1c4f commit 8c5ef2a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
45 changes: 19 additions & 26 deletions lib/jquery.jcarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,51 +92,44 @@
}

if (e.nodeName.toUpperCase() == 'UL' || e.nodeName.toUpperCase() == 'OL') {
this.list = $(e);
this.container = this.list.parent();

if (this.container.hasClass('jcarousel-clip')) {
if (!this.container.parent().hasClass('jcarousel-container')) {
this.container = this.container.wrap('<div></div>');
}

this.container = this.container.parent();
} else if (!this.container.hasClass('jcarousel-container')) {
this.container = this.list.wrap('<div></div>').parent();
}
this.list = $(e);
this.clip = this.list.parents('.jcarousel-clip');
this.container = this.list.parents('.jcarousel-container');
} else {
this.container = $(e);
this.list = this.container.find('ul,ol').eq(0);
this.list = this.container.find('ul,ol').eq(0);
this.clip = this.container.find('.jcarousel-clip');
}

if (this.clip.size() === 0) {
this.clip = this.list.wrap('<div></div>').parent();
}

if (this.container.size() === 0) {
this.container = this.clip.wrap('<div></div>').parent();
}

if (skin !== '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1) {
this.container.wrap('<div class=" '+ skin + '"></div>');
}

this.clip = this.list.parent();
this.buttonPrev = $('.jcarousel-prev', this.container);

if (!this.clip.length || !this.clip.hasClass('jcarousel-clip')) {
this.clip = this.list.wrap('<div></div>').parent();
if (this.buttonPrev.size() === 0 && this.options.buttonPrevHTML !== null) {
this.buttonPrev = $(this.options.buttonPrevHTML).appendTo(this.container);
}

this.buttonPrev.addClass(this.className('jcarousel-prev'));

this.buttonNext = $('.jcarousel-next', this.container);

if (this.buttonNext.size() === 0 && this.options.buttonNextHTML !== null) {
this.buttonNext = this.clip.after(this.options.buttonNextHTML).next();
this.buttonNext = $(this.options.buttonNextHTML).appendTo(this.container);
}

this.buttonNext.addClass(this.className('jcarousel-next'));

this.buttonPrev = $('.jcarousel-prev', this.container);

if (this.buttonPrev.size() === 0 && this.options.buttonPrevHTML !== null) {
this.buttonPrev = this.clip.after(this.options.buttonPrevHTML).next();
}

this.buttonPrev.addClass(this.className('jcarousel-prev'));

this.clip.addClass(this.className('jcarousel-clip')).css({
overflow: 'hidden',
position: 'relative'
});

Expand Down
2 changes: 1 addition & 1 deletion lib/jquery.jcarousel.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions skins/ie7/skin.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
padding: 40px 20px;
}

.jcarousel-skin-ie7 .jcarousel-clip {
overflow: hidden;
}

.jcarousel-skin-ie7 .jcarousel-clip-horizontal {
width: 245px;
height: 77px;
Expand Down
4 changes: 4 additions & 0 deletions skins/tango/skin.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
padding: 40px 20px;
}

.jcarousel-skin-tango .jcarousel-clip {
overflow: hidden;
}

.jcarousel-skin-tango .jcarousel-clip-horizontal {
width: 245px;
height: 75px;
Expand Down

0 comments on commit 8c5ef2a

Please sign in to comment.