Uncaught TypeError: Cannot set property 'control' of undefined
See original GitHub issue@nolimits4web plz help!
I use the loop parameter and it would be wrong, and Thumbs Gallery With Two-way Control can be used.
this is my code:
<div class="swiper-container a">
<div class="swiper-wrapper">
<div class="swiper-slide a-slide">
<div style="width: 100%;height: 100%;">
<div style="width: 100%;height: 100%;">
<div class="swiper-container gallery-top">
<div class="swiper-wrapper">
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/1)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/2)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/3)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/4)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/5)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/6)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/7)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/8)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/9)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/10)"></div>
</div>
<!-- Add Arrows -->
<div class="swiper-button-next swiper-button-white"></div>
<div class="swiper-button-prev swiper-button-white"></div>
</div>
<div class="swiper-container gallery-thumbs">
<div class="swiper-wrapper">
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/1)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/2)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/3)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/4)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/5)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/6)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/7)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/8)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/9)"></div>
<div class="swiper-slide" style="background-image:url(http://lorempixel.com/1200/1200/nature/10)"></div>
</div>
</div>
</div>
</div>
</div>
<div class="swiper-slide">Slide 2</div>
<div class="swiper-slide">Slide 3</div>
</div>
</div>
<script type="text/javascript" src="dist/js/swiper.min.js"></script>
<script type="text/javascript">
var swiper = new Swiper('.a', {
loop: true
});
var galleryTop = new Swiper('.gallery-top', {
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
spaceBetween: 10,
loop:true,
loopedSlides: 5, //looped slides should be the same
nested: true
});
var galleryThumbs = new Swiper('.gallery-thumbs', {
spaceBetween: 10,
slidesPerView: 4,
touchRatio: 0.2,
loop:true,
loopedSlides: 5, //looped slides should be the same
nested: true,
slideToClickedSlide: true
});
galleryTop.params.control = galleryThumbs;
galleryThumbs.params.control = galleryTop;
</script>
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot set property 'control' of undefined
I am getting this script error in Chrome 67.0. 3396.99 when I click a button to edit a column of RadGrid using a...
Read more >Uncaught TypeError: Cannot set property
In JavaScript if a variable has been declared, but has not been assigned a value, is automatically assigned the value undefined . Therefore,...
Read more >Uncaught TypeError: Cannot set property 'control' of undefined ...
I use the loop parameter and it would be wrong, and Thumbs Gallery With Two-way Control can be used. this is my code:...
Read more >TypeError: Cannot set properties of Undefined in JavaScript
The "Cannot set properties of undefined" error occurs when setting a property on an undefined value. To solve the error, conditionally check if...
Read more >Uncaught TypeError: Cannot set properties of undefined ...
I'm getting an error Uncaught TypeError: Cannot set properties of undefined (setting 'control') How can I fix it?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Really does not find the items. Error appears on pages where the slider does not exist. Use the condition.
For the topic-starter’s code and for others demos I maked it work. Just surrounded all Swiper’s JS code with jQuery (I’m using it with side slideshow):
$(document).ready(function() { var mainSliderSelector = '.main-slider', navSliderSelector = '.nav-slider', interleaveOffset = 0.5; // Main Slider var mainSliderOptions = {/*...*/} var mainSlider = new Swiper(mainSliderSelector, mainSliderOptions); // Navigation Slider var navSliderOptions = {/*...*/} var navSlider = new Swiper(navSliderSelector, navSliderOptions); // Matching sliders mainSlider.params.control = navSlider; navSlider.params.control = mainSlider; });Hope this helps someone 😉