意见反馈栏实现cookie缓存收拉属性,实现页面刷新跳转,意见反馈栏收拉一致

This commit is contained in:
whimlex 2015-01-28 12:13:17 +08:00
parent a6488da7fa
commit b7c7cc4c64
1 changed files with 42 additions and 7 deletions

View File

@ -63,7 +63,7 @@ a:hover.opnionButton{ text-decoration:underline;}
(function($){
$.fn.fix = function(options){
var defaults = {
float : 'left',
float : 'right',
minStatue : false,
skin : 'blue',
durationTime : 1000
@ -81,7 +81,7 @@ a:hover.opnionButton{ text-decoration:underline;}
var defaultTop = thisBox.offset().top; //????????top
thisBox.css(options.float, 0);
if(options.minStatue){
if(options.minStatue == "true"){
$(".show_btn").css("float", options.float);
sideContent.css('width', 0);
show_btn.css('width', 25);
@ -106,15 +106,18 @@ a:hover.opnionButton{ text-decoration:underline;}
closeBtn.bind("click",function(){
sideContent.animate({width: '0px'},"fast");
show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast");
cookiesave('minStatue','true','','','');
});
//show???
show_btn.click(function() {
show_btn.bind("click",function() {
$(this).animate({width: '0px'},"fast");
sideContent.stop(true, true).delay(200).animate({ width: '154px'},"fast");
cookiesave('minStatue','false','','','');
});
}); //end this.each
}); //end this.each
};
})(jQuery);
@ -130,6 +133,38 @@ function f_submit()
{
$("#new_memo").submit();
}
function cookiesave(n, v, mins, dn, path)
{
if(n)
{
if(!mins) mins = 365 * 24 * 60;
if(!path) path = "/";
var date = new Date();
date.setTime(date.getTime() + (mins * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
if(dn) dn = "domain=" + dn + "; ";
document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path;
}
}
function cookieget(n)
{
var name = n + "=";
var ca = document.cookie.split(';');
for(var i=0;i<ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(name) == 0){
return c.substring(name.length,c.length);}
}
return false;
}
</script>
@ -140,7 +175,7 @@ function f_submit()
</head>
<body style="height:auto" >
<!-- ?ú?? ???? -->
<div class="scrollsidebar" id="scrollsidebar">
<div class="scrollsidebar" id="scrollsidebar" style="float: right">
<div class="side_content">
<div class="side_list">
<div class="side_title"><a title="意见反馈" class="close_btn"><span><%= l(:label_feedback) %></span></a></div>
@ -171,7 +206,7 @@ function f_submit()
$(function() {
$("#scrollsidebar").fix({
float : 'right', //default.left or right
//minStatue : true,
minStatue : cookieget('minStatue'),
skin : 'green', //default.gray or blue
durationTime : 600
});