使用html代码中的javascript仅重新加载一次特定页面

时间:2018-07-28 14:51:03

标签: javascript java jquery html jquery-mobile

我正在构建一个jquery移动网页。我在图片库中使用了滑动滑块插件。但是,如果不重新加载页面,导航按钮和和分页将无法正常工作。当访问者进入第六页时。我只想 自动仅刷新该页面一次。我在该页面中的图片库。我的html代码是这样的。我想我们可以用Java脚本代码重新加载网页。但是,尽管我做了很多研究,但找不到解决方案。如果您能帮助我,我将不胜感激。

<div data-role="page" id="page6">

  <div data-role="header">
   <div class="logo"></div>
   <div class="blueline"></div>
  </div>
  <div data-role="content" class="bodycopy"><center>Resimleri Görmek İçin Yukarı Kaydırın</center>

    <div class="swiper-container">
    <div class="swiper-wrapper">

      <div class="swiper-slide" ><img src="images/image-1.jpg" alt="resim-1"></div>
      <div class="swiper-slide" ><img src="images/image-2.jpg" alt="resim-2"></div>
      <div class="swiper-slide" ><img src="images/image-3.jpg" alt="resim-3"></div>
      <div class="swiper-slide" ><img src="images/image-4.jpg" alt="resim-4"></div>
      <div class="swiper-slide" ><img src="images/image-5.jpg" alt="resim-5"></div>
      <div class="swiper-slide" ><img src="images/image-6.jpg" alt="resim-6"></div>
       </div>
      <div class="swiper-pagination"></div>
      <div class="swiper-button-prev"></div>
    <div class="swiper-button-next"></div>
    </div>




  <div data-role="footer" class="footer">
     <h4><a href="#page" data-role="button" data-icon="back" data-iconpos="notext">Button</a></h4>
  </div>
</div>

2 个答案:

答案 0 :(得分:0)

您可以将triggerimport cv2 import matplotlib.pyplot as plt IMG_SIZE = 224 im = cv2.cvtColor(cv2.imread('lena.jpg'), cv2.COLOR_BGR2GRAY) im = cv2.resize(im, (IMG_SIZE, IMG_SIZE)) # Your detector results detected_region = [ [(10, 20) , (80, 100)], [(50, 0) , (220, 190)], [(100, 143) , (180, 200)], [(110, 45) , (180, 150)] ] # Global states x_scale = 1.0 y_scale = 1.0 x_shift = 0 y_shift = 0 x1, y1 = 0, 0 x2, y2 = IMG_SIZE-1, IMG_SIZE-1 for region in detected_region: # Detection x_scale = IMG_SIZE / (x2-x1) y_scale = IMG_SIZE / (y2-y1) x_shift = x1 y_shift = y1 cur_im = cv2.resize(im[y1:y2, x1:x2], (IMG_SIZE, IMG_SIZE)) # Assuming the detector return these results cv2.rectangle(cur_im, region[0], region[1], (255)) plt.imshow(cur_im) plt.show() # Zooming in, using part of your code context_pixels = 16 x1 = max(region[0][0] - context_pixels, 0) / x_scale + x_shift y1 = max(region[0][1] - context_pixels, 0) / y_scale + y_shift x2 = min(region[1][0] + context_pixels, IMG_SIZE) / x_scale + x_shift y2 = min(region[1][1] + context_pixels, IMG_SIZE) / y_scale + y_shift x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2) # Assuming the detector confirm its choice here print('Confirmed detection: ', x1, y1, x2, y2) # This time no padding x1 = detected_region[-1][0][0] / x_scale + x_shift y1 = detected_region[-1][0][1] / y_scale + y_shift x2 = detected_region[-1][1][0] / x_scale + x_shift y2 = detected_region[-1][1][1] / y_scale + y_shift x1, y1, x2, y2 = int(x1), int(y1), int(x2), int(y2) cv2.rectangle(im, (x1, y1), (x2, y2), (255, 0, 0)) plt.imshow(im) plt.show() 结合使用,作为旧版浏览器的后备方式,以重新加载Javascript页面。

location.reload()

答案 1 :(得分:0)

作为研究的结果,我找到了这样的解决方案:

我将我的jquery移动网站划分为不同的页面。如此多页的网站。并为滑动滑块创建了一个外部js文件。我将.js链接放在body标签的末尾,该标签的页面包含滑动条代码。现在一切都好。效果很好。在进行此编辑之前,所有页面代码都位于同一文件中。因此,滑动器滑块无法正常工作。现在,我不需要刷新页面。