如何每天或每小时制作一次弹出模态节目

时间:2017-11-12 11:38:08

标签: javascript

我知道有很多关于此的答案,但我似乎无法用我的代码实现它。我想要做的是当用户打开主页时,弹出的推荐只会每天或每小时显示一次。非常感谢任何帮助和建议。

这是在页面加载时启动弹出模式的代码。

import cv2

def rotate_image(mat, angle):
    """
    Rotates an image (angle in degrees) and expands image to avoid cropping
    """

    height, width = mat.shape[:2] # image shape has 3 dimensions
    image_center = (width/2, height/2) # getRotationMatrix2D needs coordinates in reverse order (width, height) compared to shape

    rotation_mat = cv2.getRotationMatrix2D(image_center, angle, 1.)

    # rotation calculates the cos and sin, taking absolutes of those.
    abs_cos = abs(rotation_mat[0,0]) 
    abs_sin = abs(rotation_mat[0,1])

    # find the new width and height bounds
    bound_w = int(height * abs_sin + width * abs_cos)
    bound_h = int(height * abs_cos + width * abs_sin)

    # subtract old image center (bringing image back to origo) and adding the new image center coordinates
    rotation_mat[0, 2] += bound_w/2 - image_center[0]
    rotation_mat[1, 2] += bound_h/2 - image_center[1]

    # rotate image with the new bounds and translated rotation matrix
    rotated_mat = cv2.warpAffine(mat, rotation_mat, (bound_w, bound_h))
    return rotated_mat

这是弹出模式的代码

array1 = [0 1 2 2 3 4 4 4 4 5 6 6 7 8 9]
a1 = hist(array1,max(array1)-min(array1))
[value , index] = max(a1)
u=[index-2:1:index+2]
array_matrix = a1(u)

% then value = 4 , index = 5

1 个答案:

答案 0 :(得分:0)

我知道这并不多,但它可能会帮助那些有这样问题的人。这是我怎么做的

<?php 
    if(mysqli_num_rows($check_ip) > 0 && isset($_SESSION["popUp"]) == false) 
    {
    $_SESSION["popUp"] = "true";
    ?>
    <script type="text/javascript">
            $(document).ready(function()
            {
                $("#myModal").modal('show');
            });
        </script>
    <?php 
    }
    ?>