Comments (9)
I am having the same issue, I was resolved it by checking array length code as follows:
```
let ImageList = $.map(this.state.data, function (data, index) {
if (parseInt(this.state.selectedcaseitem) === parseInt(index)) {
return (
$.map(data.screenshots, function (d, i) {
return (
<span className="item" key={i}>
<img src={d.screenshot} alt="" />
</span>
);
}.bind(this))
);
}
}.bind(this));
And the length checking should be
<span className="large-12 columns">
{ImageList.length>0?
<OwlCarousel {...options} className="owl-theme" >
{ImageList}
</OwlCarousel>:""}
</span>
from react-owl-carousel.
Checking the array length works.
{this.state.posts.length>0?
<OwlCarousel ref="car" options={options} events={events}>
{this.state.posts.map( (post) =>
<div>
<a href={ post.link }>
<img src={ post.image } alt={ post.name } className="post-image" />
<p>{ post.name }</p>
</a>
</div>
)
}
</OwlCarousel>
:""}
from react-owl-carousel.
Here is how I solved this issue (for Meteor + React Project) -
OwlCarousel.js adds the empty slide not the React part of it.
-
Remove react-owl-carousel from your project
-
Download the react-owl-carousel zip package from git and extract it to temporary location
-
From the 'components' folder of the extracted content, copy the OwlCarousel.jsx to your project
-
Download the latest OwlCarousel.js (https://owlcarousel2.github.io/OwlCarousel2/docs/started-welcome.html)
-
Extract the zip file to temporary location then copy the OwlCarousel.js to your project
-
While you are there you can also copy the css files to your project
-
Open the OwlCarousel.js from your project and go to 'Owl.prototype.replace = function(content) {'
(should be around line 1289) -
In that function find '}).each($.proxy(function(index, item) {'
-
Add the following code just under this.$stage.append(item);
``let i = item[0].children[0]; let clsNm; if(i){ clsNm = $(i).attr('class'); } if(clsNm !== 'owl-stage') { this._items.push(item); }
-
Don't forget to change 'import' statements to the OwlCarousel.jsx that is in your project
In all fairness I did not do a lot of testing with this change but it seems to work perfectly good.
from react-owl-carousel.
from react-owl-carousel.
i solve this in react-owl-carousel just using this css property
.owl-item.active:first-child {
display: none;
}
this is my setup
return(
<div className='item' key={art.id}>
<div className="center-crop">
<a href="" className="category-link">
<span className="label-warning">{art.categories.peek().name}</span>
</a>
<Link to={`/articulo/${art.permalink}`}>
<img src={methods.checkmedia(art)} alt={art.title} className='img-carousel'/>
</Link>
<div className="carousel-link">
<Link to={`/articulo/${art.permalink}`}>
{art.title}
</Link>
</div>
</div>
{methods.checkVideoArticle(art)}
<div className="newSummary">
{art.highlight}
</div>
</div>)
from react-owl-carousel.
I am having the same issue when loading the slides from an array, where an additional blank element is added. My implementation is similar to the above.
from react-owl-carousel.
@dhill1 Did you fix it or find a work around ?
from react-owl-carousel.
@ijosorio1022 no I was not able to solve this one
from react-owl-carousel.
i solve this in react-owl-carousel just using this css property .owl-item.active:first-child { display: none; } this is my setup
return( <div className='item' key={art.id}> <div className="center-crop"> <a href="" className="category-link"> <span className="label-warning">{art.categories.peek().name}</span> </a> <Link to={`/articulo/${art.permalink}`}> <img src={methods.checkmedia(art)} alt={art.title} className='img-carousel'/> </Link> <div className="carousel-link"> <Link to={`/articulo/${art.permalink}`}> {art.title} </Link> </div> </div> {methods.checkVideoArticle(art)} <div className="newSummary"> {art.highlight} </div> </div>)
this solution fix my problem.
from react-owl-carousel.
Related Issues (20)
- How to filter? HOT 1
- Not able to update state variable on onChanged callback , gives error 'unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering' HOT 1
- Add Typescript support
- index.js:1 Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code.
- UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. | Please update the following components: ReactOwlCarousel HOT 9
- window is not defined HOT 1
- SlideTransition prop doesn't exist in react
- Bank white page issue HOT 2
- autoHeightClass doesnt work
- react-owl-carousel mobile issue - one slide getting place at the top of the another slide at arr HOT 1
- i can't use methods HOT 1
- carousel installed but not working
- nav button is not working for scrolling card
- navContainer not working
- jQuery cannot see $
- dotData not working
- Blank OwlCarousel : items moved from .owl-stage to .owl-carousel when resize the window mobile
- Warning: Invalid DOM property `class`. Did you mean `className` HOT 1
- UNSAFE_componentWillReceiveProps HOT 6
- Fails to install in React 17 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-owl-carousel.