Click here to Skip to main content
15,880,972 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: Javascript function error. Pin
jkirkerx12-Jun-20 11:11
professionaljkirkerx12-Jun-20 11:11 
GeneralRe: Javascript function error. Pin
jkirkerx12-Jun-20 10:17
professionaljkirkerx12-Jun-20 10:17 
GeneralRe: Javascript function error. Pin
and180y13-Jun-20 5:57
and180y13-Jun-20 5:57 
GeneralRe: Javascript function error. Pin
Richard MacCutchan13-Jun-20 6:31
mveRichard MacCutchan13-Jun-20 6:31 
GeneralRe: Javascript function error. Pin
and180y13-Jun-20 11:48
and180y13-Jun-20 11:48 
GeneralRe: Javascript function error. Pin
jkirkerx13-Jun-20 7:36
professionaljkirkerx13-Jun-20 7:36 
GeneralRe: Javascript function error. Pin
and180y13-Jun-20 11:47
and180y13-Jun-20 11:47 
QuestionJavaScript slide show works bad on the first page load Pin
Hypnonis8-Jun-20 20:03
Hypnonis8-Jun-20 20:03 
Hello,

I'm having an issue with my javascript slider inside removals page.

You can check it out on www.poznanprzeprowadzki.pl (not a commercial :P), section "Galeria".

On the first load, the slideshow works but, the 3/4 of one image and 1/4 of second image is inside the slideshow-container. It is possible to slide through the gallery, but one click on the button isn't moving the image enough. After the refresh, inside the slideshow-container there is only one image, and it works fine sliding through gallery.

I included the script after the footer section. Hope someone can help me... Smile | :)

<script>
		const slideshowSlide = document.querySelector('.slideshow-slide');
		const slideshowImages = document.querySelectorAll('.slideshow-slide img');

		//Buttons

		const prevBtn = document.querySelector('#prevBtn');
		const nextBtn = document.querySelector('#nextBtn');

		//Counter
		let counter = 1;
		const size = slideshowImages[0].clientWidth;

		slideshowSlide.style.transform = 'translateX(' + (-size * counter) + 'px)';

		//Button Listeners

		nextBtn.addEventListener('click',function(){
			if (counter >= slideshowImages.length-1) return;
			slideshowSlide.style.transition = 'transform 0.4s ease-in-out';
			counter++;
			slideshowSlide.style.transform = 'translateX(' + (-size * counter) + 'px)';
		});

		prevBtn.addEventListener('click',function(){
			if (counter <= 0) return;
			slideshowSlide.style.transition = 'transform 0.4s ease-in-out';
			counter--;
			slideshowSlide.style.transform = 'translateX(' + (-size * counter) + 'px)';
		});

		slideshowSlide.addEventListener('transitionend', ()=>{
			if (slideshowImages[counter].id === 'lastclone') {
				slideshowSlide.style.transition = "none";
				counter = slideshowImages.length - 2;
				slideshowSlide.style.transform = 'translateX(' + (-size * counter) + 'px)';
			}
			if (slideshowImages[counter].id === 'firstclone') {
				slideshowSlide.style.transition = "none";
				counter = slideshowImages.length - counter;
				slideshowSlide.style.transform = 'translateX(' + (-size * counter) + 'px)';
			}
		});
	</script>

AnswerRe: JavaScript slide show works bad on the first page load Pin
Richard Deeming8-Jun-20 22:30
mveRichard Deeming8-Jun-20 22:30 
GeneralRe: JavaScript slide show works bad on the first page load Pin
Hypnonis9-Jun-20 6:33
Hypnonis9-Jun-20 6:33 
QuestionJSON object not showing values.. Can someone help Pin
Member 35640766-Jun-20 4:33
Member 35640766-Jun-20 4:33 
GeneralRe: JSON object not showing values.. Can someone help Pin
Richard MacCutchan7-Jun-20 0:50
mveRichard MacCutchan7-Jun-20 0:50 
QuestionPyramid array Pin
Girardi.E30-May-20 0:48
Girardi.E30-May-20 0:48 
AnswerRe: Pyramid array Pin
Richard MacCutchan30-May-20 1:15
mveRichard MacCutchan30-May-20 1:15 
AnswerRe: Pyramid array Pin
DerekT-P30-May-20 2:30
professionalDerekT-P30-May-20 2:30 
Questionidentify each node with its Id Pin
vikas@prajaktasoftware.com19-May-20 8:57
vikas@prajaktasoftware.com19-May-20 8:57 
SuggestionRe: identify each node with its Id Pin
ZurdoDev19-May-20 9:39
professionalZurdoDev19-May-20 9:39 
QuestionReturn negative number as 0 Pin
and180y18-May-20 1:46
and180y18-May-20 1:46 
AnswerRe: Return negative number as 0 Pin
Richard MacCutchan18-May-20 2:05
mveRichard MacCutchan18-May-20 2:05 
GeneralRe: Return negative number as 0 Pin
and180y18-May-20 2:27
and180y18-May-20 2:27 
GeneralRe: Return negative number as 0 Pin
Richard MacCutchan18-May-20 2:40
mveRichard MacCutchan18-May-20 2:40 
AnswerRe: Return negative number as 0 Pin
Richard Deeming18-May-20 5:43
mveRichard Deeming18-May-20 5:43 
GeneralRe: Return negative number as 0 Pin
and180y18-May-20 13:10
and180y18-May-20 13:10 
Questiongenerate a mongo bson objectId in angular V7+ Pin
jkirkerx17-May-20 12:51
professionaljkirkerx17-May-20 12:51 
QuestionHow to format the file containing json objects to json array Pin
kjeeva15-May-20 21:53
kjeeva15-May-20 21:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.