1. <html>
  2. <style type="text/css">
  3. a.tooltip {
  4. outline: none;
  5. }
  6. a.tooltip strong {
  7. line-height: 30px;
  8. }
  9. a.tooltip:hover {
  10. text-decoration: none;
  11. }
  12. a.tooltip span {
  13. z-index: 10;
  14. display: none;
  15. padding: 14px 20px;
  16. margin-top: 60px;
  17. margin-left: -160px;
  18. width: 300px;
  19. line-height: 16px;
  20. }
  21. a.tooltip:hover span {
  22. margin-top: 180px;
  23. display: inline;
  24. position: absolute;
  25. border: 2px solid #FFF;
  26. color: #EEE;
  27. background: #333 url(http://www.menucool.com/tooltip/cssttp/css-tooltip-gradient-bg.png) repeat-x 0 0;
  28. }
  29. .callout {
  30. z-index: 20;
  31. position: absolute;
  32. border: 0;
  33. top: -14px;
  34. left: 120px;
  35. }
  36. /*CSS3 extras*/
  37. a.tooltip span {
  38. border-radius: 2px;
  39. box-shadow: 0px 0px 8px 4px #666;
  40. /*opacity: 0.8;*/
  41. }
  42. img.img-responsive.img-align {
  43. margin: 0 auto;
  44. width: 250px;
  45. height: 150px;
  46. margin-top: 20px;
  47. margin-bottom: 10px;
  48. }
  49. span.imp {
  50. font-size: 140%;
  51. color: ghostwhite;
  52. }
  53. table#tableEmployee {}
  54. .spacing-table {
  55. font-family: 'Helvetica', 'Arial', sans-serif;
  56. font-size: 15px;
  57. table-layout: fixed;
  58. width: 100%;
  59. border-spacing: 0 5px;
  60. /* this is the ultimate fix */
  61. }
  62. .spacing-table th {
  63. text-align: left;
  64. padding: 5px 15px;
  65. }
  66. .spacing-table td {
  67. padding-left: 25px;
  68. border-width: 3px 0;
  69. width: 50%;
  70. border-color: darkred;
  71. border-style: solid;
  72. background-color: rgba(109, 7, 7, 0.29);
  73. color: white;
  74. }
  75. .spacing-table td:first-child {
  76. border-left-width: 3px;
  77. border-radius: 50px 0 0 5px;
  78. }
  79. .spacing-table td:last-child {
  80. border-right-width: 3px;
  81. border-radius: 0 5px 5px 0;
  82. }
  83. .spacing-table thead {
  84. display: table;
  85. table-layout: fixed;
  86. width: 100%;
  87. }
  88. .spacing-table tbody {
  89. display: table;
  90. table-layout: fixed;
  91. width: 100%;
  92. border-spacing: 0 30px;
  93. border-collapse: separate;
  94. }
  95. div#PriceSlider {
  96. width: 22%;
  97. }
  98. </style>
  99. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
  100. <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  101. <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
  102. <script>
  103. $(document).ready(function() {
  104. $("#PriceSlider").slider({
  105. min: 5000,
  106. max: 100000,
  107. values: [5000, 20000],
  108. range: true,
  109. slide: function(event, ui) {
  110. $("#price").val("₹" + ui.values[0] + " - ₹" + ui.values[1]);
  111. }
  112. });
  113. $("#PriceSlider").on("slidestop", function(event, ui) {
  114. var pricefilterstring = _spPageContextInfo.webAbsoluteUrl + "/_api/lists/getByTitle('MasterList')/items?$select=Title,ID,price,description,phonenumber,subcategory,AttachmentFiles/ServerRelativeUrl&$expand=AttachmentFiles&$filter=((subcategory eq '" + name + "') and (price gt " + ui.values[0] + " and price lt " + ui.values[1] + "))";
  115. getitems(pricefilterstring);
  116. });
  117. var name = getParameterByName("itemid");
  118. function getParameterByName(name, url) {
  119. if (!url) url = window.location.href;
  120. name = name.replace(/[\[\]]/g, "\\$&");
  121. var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
  122. results = regex.exec(url);
  123. if (!results) return null;
  124. if (!results[2]) return '';
  125. return decodeURIComponent(results[2].replace(/\+/g, " "));
  126. }
  127. var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getByTitle('MasterList')/items?$select=Title,ID,price,description,phonenumber,subcategory,AttachmentFiles/ServerRelativeUrl&$expand=AttachmentFiles&$filter=subcategory eq '" + name + "'";
  128. getitems(requestUri);
  129. function getitems(urlstring) {
  130. $.ajax({
  131. url: urlstring,
  132. type: "GET",
  133. headers: {
  134. "accept": "application/json; odata=verbose"
  135. },
  136. success: onSuccess,
  137. error: onError
  138. });
  139. function onSuccess(data) {
  140. var objItems = data.d.results;
  141. var tableContent = '<table id="tableEmployee" class="spacing-table" >';
  142. for (var i = 0; i < objItems.length; i++) {
  143. tableContent += '<tr>';
  144. console.log(objItems[i].ID);
  145. tableContent += "<td> <span class='imp'> " + objItems[i].Title + " </span></td>";
  146. tableContent += "<td><a href='#'class='tooltip'><img src='" + objItems[i].AttachmentFiles.results[0].ServerRelativeUrl + "'class='img-responsive img-align'alt='Responsive image'> <span><img class='callout' src='http://www.menucool.com/tooltip/cssttp/callout_black.gif' /> <strong>Details</strong><br />" + objItems[i].description + "<br />₹" + objItems[i].price + "</span></a></td>";
  147. tableContent += "<td><a href='UrUrl/SitePages/Ad%20Details%20View.aspx?itemid=" + objItems[i].ID + "'>Contact the owner</td>";
  148. tableContent += '</tr>';
  149. }
  150. tableContent += '</table>';
  151. $('#CustomerPanel').empty();
  152. $('#CustomerPanel').append(tableContent);
  153. }
  154. function onError(error) {
  155. alert('Error');
  156. }
  157. }
  158. });
  159. </script>
  160. <div id="PriceSlider"></div>
  161. <p> <label for="price">Price range:</label> <input type="text" id="price" style="border:0; color:#b9cd6d; font-weight:bold;"> </p>
  162. <div id="CustomerPanel"> </div>
  163. </html>