metalni

[szdnki] 1. kol jQuery

Dec 5th, 2020
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.08 KB | None | 0 0
  1. $(document).ready(function (){
  2.     let id = -1;
  3.     $("#low-level").hide()
  4.  
  5.     $(".click").click(function (){
  6.         id = $(this).attr("title")
  7.         $("#high-level").hide()
  8.         $("#low-level").show()
  9.         $("#0, #1, #2").hide()
  10.         $("#" + id).show()
  11.     })
  12.  
  13.     $("#top").click(function (){
  14.         $("#low-level").hide()
  15.         $("#high-level").show()
  16.     })
  17.  
  18.     $("#next").click(function (){
  19.         $("#" + id).hide()
  20.         id++
  21.         id = id === 3 ? 0 : id
  22.         $("#" + id).show()
  23.     })
  24.  
  25.     $("#prev").click(function (){
  26.         $("#" + id).hide()
  27.         id--
  28.         id = id < 0 ? 3 - 1 : id
  29.         $("#" + id).show()
  30.     })
  31.  
  32.     let index = -1;
  33.     $("#dialog").dialog({
  34.         autoOpen: false,
  35.         modal: true,
  36.         buttons: {
  37.             Rate: function () {
  38.                 $("#data-" + index).html($("#input-data").val())
  39.                 $("#dialog").dialog("close")
  40.             }
  41.         }
  42.     })
  43.  
  44.     $(".modal").click(function (){
  45.         index = $(this).attr("title")
  46.         $("#dialog").dialog("open")
  47.     })
  48. })
Add Comment
Please, Sign In to add comment