首次登录后{HI 44 div}

时间:2016-01-07 05:41:08

标签: javascript jquery html

我的网页上有一个div。

我想在我第一次登录时隐藏它,但是在每次重新加载div之后都应该打开div。

我想用jquery做这个。

<div class="expandable">
      <li class="menu"><span>Dispute</span>
</div>

3 个答案:

答案 0 :(得分:0)

成功登录后,将此代码写入您的文件中 您可以在用户登录函数

后编写此代码或函数
 $(".expandable").hide();

答案 1 :(得分:0)

您需要使用cookie或会话。

每次访问网站时,系统都会检查cookie是否存在,如果已经设置,则显示div。这些将在第一次登录时设置,因此对于之后的每次访问,它将在那里显示div。

如果您需要登录用户,则应使用会话,遵循与上述相同的逻辑。在会话中设置一个值并在显示div之前检查它是否存在。

设置Cookie的示例代码:

$.cookie("Show", 1, {
  path    : '/',          //The value of the path attribute of the cookie 
                       //(default: path of page that created the cookie).

 domain  : 'yourdomain.com',  //The value of the domain attribute of the cookie
                       //(default: domain of page that created the cookie).

 secure  : true          //If set to true the secure attribute of the cookie
                       //will be set and the cookie transmission will
                       //require a secure protocol (defaults to false).
});

答案 2 :(得分:0)

你可以使用stdClass Object ( [language] => en [textAngle] => 0 [orientation] => Up [regions] => Array ( [0] => stdClass Object ( [boundingBox] => 81,63,1340,1055 [lines] => Array ( [0] => stdClass Object ( [boundingBox] => 321,63,855,117 [words] => Array ( [0] => stdClass Object ( [boundingBox] => 321,63,174,94 [text] => Set ) [1] => stdClass Object ( [boundingBox] => 529,87,126,69 [text] => an ) [2] => stdClass Object ( [boundingBox] => 693,65,483,115 [text] => example. ) ) ) [1] => stdClass Object ( [boundingBox] => 218,182,1059,116 [words] => Array ( [0] => stdClass Object ( [boundingBox] => 218,182,271,92 [text] => Treat ) [1] => stdClass Object ( [boundingBox] => 521,203,504,95 [text] => everyOne ) [2] => stdClass Object ( [boundingBox] => 1054,182,223,91 [text] => With ) ) ) 隐藏css中的div,并在加载页面后尝试jquery函数,如`show(),fadeIn()或toggle()'