Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

image image using next and previous button in javascript

<div style="display:block"><img  id="largeimg" data-nr="1" src="resources/images/larges/01.jpg"></div>
<img data-nr="1" class="clickable" style='cursor:pointer;' src="resources/images/thumbs/01.jpg">
<img data-nr="2" class="clickable" style='cursor:pointer;' src="resources/images/thumbs/02.jpg">
. . .

<script type = "text/javascript">       
  $(document).ready(function(){
    $(".clickable").each(function({
      this.click(function(){
         $("#largeimg").attr("src",this.attr("src")).attr("data-nr",this.attr("data-nr"));
      }
    }
  });
  function nextpic() {
    newid = parseInt($("#largeimg").attr("data-nr"))+1;
    newsrc = $(".clickable[data-nr="+newid+"]").attr("src");
    $("#largeimg").attr("src",newsrc).attr("data-nr",newid);
  }
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: angular js sharepoint crud 
Javascript :: Amazon VPC supporting 5 different IP address ranges and i wanted to know how wide those rangers are 
Javascript :: Textbelt FOR mac 
Javascript :: npm run coverage is throwing some error 
Javascript :: JS glob to regex 
Javascript :: node-emoji list 
Javascript :: leaflet draw save event 
Javascript :: imasu ka meaning in japanese 
Javascript :: different ways to write react file paths 
Javascript :: overlapping times javascripts html django 
Javascript :: how to set input of time type to current time on initialization 
Javascript :: postfix increment 
Javascript :: rxjs que recibe como parametro un observable 
Javascript :: href dentro de javascript 
Javascript :: firebase angular send notification to by tocken 
Javascript :: rdlc refresh dataset from object 
Javascript :: how to filter data from mongodb date in reactjs 
Javascript :: how to add a object in world in matter.js 
Javascript :: what does conservatism really mean 
Javascript :: cargar datos de un id con inner join vue js 
Javascript :: sequelize log Special methods 
Javascript :: extend static class javascript 
Javascript :: how to change function name while exporting in node 
Javascript :: regex reuse pattern 
Javascript :: javascript if null use other value 
Javascript :: check if div is collpased jqeruy 
Javascript :: js check if function is available in scope 
Javascript :: MAT_DIALOG_SCROLL_STRATEGY 
Javascript :: html click to copy to clipboard 
Javascript :: Set initial state on react-native-router-flex 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =