Click here to Skip to main content
15,170,651 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: Reference an code behind variable in an external js fn Pin
BabyYoda10-Dec-20 9:58
MemberBabyYoda10-Dec-20 9:58 
GeneralRe: Reference an code behind variable in an external js fn Pin
Member 1492460710-Dec-20 10:45
MemberMember 1492460710-Dec-20 10:45 
AnswerRe: Reference an code behind variable in an external js fn Pin
BabyYoda10-Dec-20 11:06
MemberBabyYoda10-Dec-20 11:06 
GeneralRe: Reference an code behind variable in an external js fn Pin
Member 1492460710-Dec-20 12:27
MemberMember 1492460710-Dec-20 12:27 
QuestionDrawGameScreen funtion not executing Pin
Member 150158428-Dec-20 13:19
MemberMember 150158428-Dec-20 13:19 
SuggestionRe: DrawGameScreen funtion not executing Pin
Richard MacCutchan8-Dec-20 23:24
mveRichard MacCutchan8-Dec-20 23:24 
GeneralRe: DrawGameScreen funtion not executing Pin
Member 150158429-Dec-20 9:32
MemberMember 150158429-Dec-20 9:32 
QuestionTurning Client Side Script Into Pseudocode Pin
Member 150157838-Dec-20 11:06
MemberMember 150157838-Dec-20 11: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 11:12
MemberBabyYoda8-Dec-20 11:12 
AnswerRe: Turning Client Side Script Into Pseudocode Pin
Dave Kreskowiak8-Dec-20 15:21
mveDave Kreskowiak8-Dec-20 15:21 
AnswerRe: why in the world an object has stopped being a referance type Pin
Afzaal Ahmad Zeeshan20-Nov-20 13:46
mveAfzaal Ahmad Zeeshan20-Nov-20 13:46 
GeneralRe: why in the world an object has stopped being a referance type Pin
Member 1499861720-Nov-20 13:59
MemberMember 1499861720-Nov-20 13:59 
QuestionSnow fall in Javascript Pin
Member 1497619920-Nov-20 5:15
MemberMember 1497619920-Nov-20 5:15 
AnswerRe: Snow fall in Javascript Pin
Richard Deeming20-Nov-20 5:27
mveRichard Deeming20-Nov-20 5:27 
AnswerRe: Snow fall in Javascript Pin
Akshay digitally9-Dec-20 2:20
MemberAkshay digitally9-Dec-20 2:20 
Questionthe red ball follow cursor in JS Pin
Member 1497619916-Nov-20 17:38
MemberMember 1497619916-Nov-20 17:38 
AnswerRe: the red ball follow cursor in JS Pin
Richard MacCutchan16-Nov-20 22:44
mveRichard MacCutchan16-Nov-20 22:44 
Questionhms@1.0.0 No repository field Pin
Gilbert526214-Nov-20 22:02
MemberGilbert526214-Nov-20 22:02 
AnswerRe: hms@1.0.0 No repository field Pin
Richard MacCutchan14-Nov-20 23:10
mveRichard MacCutchan14-Nov-20 23:10 
QuestionJs question Pin
Member 1499144112-Nov-20 11:28
MemberMember 1499144112-Nov-20 11:28 
QuestionRe: Js question Pin
Richard MacCutchan12-Nov-20 22:44
mveRichard MacCutchan12-Nov-20 22:44 
Questiontoo many scripts? Pin
Member 1469595610-Nov-20 23:18
MemberMember 1469595610-Nov-20 23:18 
AnswerRe: too many scripts? Pin
Richard Deeming10-Nov-20 23:42
mveRichard Deeming10-Nov-20 23:42 
GeneralRe: too many scripts? Pin
Member 1469595611-Nov-20 0:37
MemberMember 1469595611-Nov-20 0:37 
AnswerRe: too many scripts? Pin
Sandeep Mewara10-Nov-20 23:46
mveSandeep Mewara10-Nov-20 23: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.