Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery并保存页面之间的参数_Jquery_Html_Css_Spring - Fatal编程技术网

jQuery并保存页面之间的参数

jQuery并保存页面之间的参数,jquery,html,css,spring,Jquery,Html,Css,Spring,能记住潜水舱的高度吗?例如,在一个网站上,我展开有一些内容的div,然后单击另一个具有不同内容但具有相同div(相同id和类)的页面。不幸的是,一切都恢复正常,并失去了div的高度 我在html中得到了框架的效果(但是你怎么看它不像我想的那样工作)。花了多长时间?是否将数据保留在会话中?需要例子 我使用的是jQuery,SpringMVC,如果有人问,你可以简单地使用HTML5本地存储机制 您可以根据需要使用.height()、.innerHeight()或outerHeight() 下面是一

能记住潜水舱的高度吗?例如,在一个网站上,我展开有一些内容的div,然后单击另一个具有不同内容但具有相同div(相同id和类)的页面。不幸的是,一切都恢复正常,并失去了div的高度

我在html中得到了框架的效果(但是你怎么看它不像我想的那样工作)。花了多长时间?是否将数据保留在会话中?需要例子


我使用的是jQuery,SpringMVC,如果有人问,你可以简单地使用HTML5本地存储机制

您可以根据需要使用
.height()
.innerHeight()
outerHeight()

下面是一个例子-

jquery

if(localStorage.divheight) //extract the old height
{ 
    // handle the height as you want here
    alert('Old height from local storage: '+ localStorage.divheight);
}

//Code just to show the mechanism of LocalStorage
$(document).ready(function(){    
   $('#result').click (function () {

        //Remember the height
      localStorage.divheight = $("div").height(); 

       //Tell the user the freshly stored height
      alert("New height: "+localStorage.divheight);
    });
});
HTML

<div id="result">
    Some number of lines here....
    Lorem ipsum dolor sit amet, consectetur adipisicing elit
    . Fuga earum id fugit veritatis! Pariatur, magni.
</div>

这里有几行。。。。
Lorem ipsum dolor sit amet,奉献精英
. 真是太棒了!木偶,木偶。
看一看。♦