Click here to Skip to main content
16,017,245 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Reference an code behind variable in an external js fn Pin
BabyYoda10-Dec-20 8:58
BabyYoda10-Dec-20 8:58 
GeneralRe: Reference an code behind variable in an external js fn Pin
Member 1492460710-Dec-20 9:45
Member 1492460710-Dec-20 9:45 
AnswerRe: Reference an code behind variable in an external js fn Pin
BabyYoda10-Dec-20 10:06
BabyYoda10-Dec-20 10:06 
GeneralRe: Reference an code behind variable in an external js fn Pin
Member 1492460710-Dec-20 11:27
Member 1492460710-Dec-20 11:27 
QuestionDrawGameScreen funtion not executing Pin
Member 150158428-Dec-20 12:19
Member 150158428-Dec-20 12:19 
SuggestionRe: DrawGameScreen funtion not executing Pin
Richard MacCutchan8-Dec-20 22:24
mveRichard MacCutchan8-Dec-20 22:24 
GeneralRe: DrawGameScreen funtion not executing Pin
Member 150158429-Dec-20 8:32
Member 150158429-Dec-20 8:32 
QuestionTurning Client Side Script Into Pseudocode Pin
Member 150157838-Dec-20 10:06
Member 150157838-Dec-20 10:06 
Hi, I need help turning this client side script code into pseudocode

var slideIndex,slides,dots,captionText;
function initGallery(){
    slideIndex = 0;
    slides=document.getElementsByClassName("imageHolder");
    slides[slideIndex].style.opacity=1;

    captionText=document.querySelector(".captionTextHolder .captionText");
    captionText.innerText=slides[slideIndex].querySelector(".captionText").innerText;

    if(slides.length<2){
        var nextPrevBtns=document.querySelector(".leftArrow,.rightArrow");
        nextPrevBtns.style.display="none";
        for (i = 0; i < nextPrevBtn.length; i++) {
            nextPrevBtn[i].style.display="none";
        }
    }


    dots=[];
    var dotsContainer=document.getElementById("dotsContainer"),i;
    for (i = 0; i < slides.length; i++) {
        var dot=document.createElement("span");
        dot.classList.add("dots");
        dotsContainer.append(dot);
        dot.setAttribute("onclick","moveSlide("+i+")");
        dots.push(dot);
    }
    dots[slideIndex].classList.add("active");
}
initGallery();
function plusSlides(n) {
    moveSlide(slideIndex+n);
}
function moveSlide(n){
    var i;
    var current,next;
    var moveSlideAnimClass={
          forCurrent:"",
          forNext:""
    };
    var slideTextAnimClass;
    if(n>slideIndex) {
        if(n >= slides.length){n=0;}
        moveSlideAnimClass.forCurrent="moveLeftCurrentSlide";
        moveSlideAnimClass.forNext="moveLeftNextSlide";
        slideTextAnimClass="slideTextFromTop";
    }else if(n<slideIndex){
        if(n<0){n=slides.length-1;}
        moveSlideAnimClass.forCurrent="moveRightCurrentSlide";
        moveSlideAnimClass.forNext="moveRightPrevSlide";
        slideTextAnimClass="slideTextFromBottom";
    }

    if(n!=slideIndex){
        next = slides[n];
        current=slides[slideIndex];
        for (i = 0; i < slides.length; i++) {
            slides[i].className = "imageHolder";
            slides[i].style.opacity=0;
            dots[i].classList.remove("active");
        }
        current.classList.add(moveSlideAnimClass.forCurrent);
        next.classList.add(moveSlideAnimClass.forNext);
        dots[n].classList.add("active");
        slideIndex=n;
        captionText.style.display="none";
        captionText.className="captionText "+slideTextAnimClass;
        captionText.innerText=slides[n].querySelector(".captionText").innerText;
        captionText.style.display="block";
    }

}
var timer=null;
function setTimer(){
    timer=setInterval(function () {
        plusSlides(1) ;
    },3000);
}
setTimer();
function playPauseSlides() {
    var playPauseBtn=document.getElementById("playPause");
    if(timer==null){
        setTimer();
        playPauseBtn.style.backgroundPositionY="0px"
    }else{
        clearInterval(timer);
        timer=null;
        playPauseBtn.style.backgroundPositionY="-33px"
    }
}

AnswerRe: Turning Client Side Script Into Pseudocode Pin
BabyYoda8-Dec-20 10:12
BabyYoda8-Dec-20 10:12 
AnswerRe: Turning Client Side Script Into Pseudocode Pin
Dave Kreskowiak8-Dec-20 14:21
mveDave Kreskowiak8-Dec-20 14:21 
AnswerRe: why in the world an object has stopped being a referance type Pin
Afzaal Ahmad Zeeshan20-Nov-20 12:46
professionalAfzaal Ahmad Zeeshan20-Nov-20 12:46 
GeneralRe: why in the world an object has stopped being a referance type Pin
Member 1499861720-Nov-20 12:59
Member 1499861720-Nov-20 12:59 
QuestionSnow fall in Javascript Pin
Member 1497619920-Nov-20 4:15
Member 1497619920-Nov-20 4:15 
AnswerRe: Snow fall in Javascript Pin
Richard Deeming20-Nov-20 4:27
mveRichard Deeming20-Nov-20 4:27 
AnswerRe: Snow fall in Javascript Pin
Akshay digitally9-Dec-20 1:20
Akshay digitally9-Dec-20 1:20 
Questionthe red ball follow cursor in JS Pin
Member 1497619916-Nov-20 16:38
Member 1497619916-Nov-20 16:38 
AnswerRe: the red ball follow cursor in JS Pin
Richard MacCutchan16-Nov-20 21:44
mveRichard MacCutchan16-Nov-20 21:44 
Questionhms@1.0.0 No repository field Pin
Gilbert526214-Nov-20 21:02
Gilbert526214-Nov-20 21:02 
AnswerRe: hms@1.0.0 No repository field Pin
Richard MacCutchan14-Nov-20 22:10
mveRichard MacCutchan14-Nov-20 22:10 
QuestionJs question Pin
Member 1499144112-Nov-20 10:28
Member 1499144112-Nov-20 10:28 
QuestionRe: Js question Pin
Richard MacCutchan12-Nov-20 21:44
mveRichard MacCutchan12-Nov-20 21:44 
Questiontoo many scripts? Pin
Member 1469595610-Nov-20 22:18
Member 1469595610-Nov-20 22:18 
AnswerRe: too many scripts? Pin
Richard Deeming10-Nov-20 22:42
mveRichard Deeming10-Nov-20 22:42 
GeneralRe: too many scripts? Pin
Member 1469595610-Nov-20 23:37
Member 1469595610-Nov-20 23:37 
AnswerRe: too many scripts? Pin
Sandeep Mewara10-Nov-20 22:46
mveSandeep Mewara10-Nov-20 22:46 

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.