html - JavaScript - Image gallery - Slide left and right -


i have responsive image gallery displays thumbnails on page, when clicked, enlarge image , open modal.

the limitations of code when have opened image, have press 'x' button, , go thumbnails in order open image.

what like, when modal opens up, enlarged image, there '<' , '>' button allows scroll through enlarged images.

any ideas how can done?

i hope clear, if not make more sense when view working example here.

thank help!

supposing image being displayed @ moment pic1 , have pic2, pic3, pic4 well. first need create array in javascript containing location of these files. assuming id of image "mainpic".

var a=['pic1','pic2'....'pic4']; var l=a.length; var currentpic=0; function changeright(){     documnet.getelementbyid("mainpic").src=++window.currentpic%window.l;     } function changeleft(){     document.getelementbyid("mainpic").src=abs(--window.currentpic%window.l);    } 

now html part need superimpose these signs- <> can using position:absolute , z index:-1. can find examples on w3school. should <aaaaaaa

, in css

enter code here      #superimpose{  position:absolute/relative;  top:100px//or other value move text on pic or use "left"        , "right"   } 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -