GithubHelp home page GithubHelp logo

Comments (9)

GaneshMitra avatar GaneshMitra commented on June 1, 2024 24

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.

floyd0987 avatar floyd0987 commented on June 1, 2024 12

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.

MenashayAu avatar MenashayAu commented on June 1, 2024 2

Here is how I solved this issue (for Meteor + React Project) -
OwlCarousel.js adds the empty slide not the React part of it.

  1. Remove react-owl-carousel from your project

  2. Download the react-owl-carousel zip package from git and extract it to temporary location

  3. From the 'components' folder of the extracted content, copy the OwlCarousel.jsx to your project

  4. Download the latest OwlCarousel.js (https://owlcarousel2.github.io/OwlCarousel2/docs/started-welcome.html)

  5. Extract the zip file to temporary location then copy the OwlCarousel.js to your project

  6. While you are there you can also copy the css files to your project

  7. Open the OwlCarousel.js from your project and go to 'Owl.prototype.replace = function(content) {'
    (should be around line 1289)

  8. In that function find '}).each($.proxy(function(index, item) {'

  9. 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);
                     }
    
  10. 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.

Ma2iio avatar Ma2iio commented on June 1, 2024 2

image
It's work.

from react-owl-carousel.

hawkbt avatar hawkbt commented on June 1, 2024 1

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.

Lucas-guida avatar Lucas-guida commented on June 1, 2024

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.

jiosorio2210 avatar jiosorio2210 commented on June 1, 2024

@dhill1 Did you fix it or find a work around ?

from react-owl-carousel.

dhill1 avatar dhill1 commented on June 1, 2024

@ijosorio1022 no I was not able to solve this one

from react-owl-carousel.

RehanRiaz5383 avatar RehanRiaz5383 commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.