使用 jquery mobile 刷新时,Raty 星级评分会消失。
编码:
布局:
<body>
<div data-role="page">
<div data-role="header" data-position="fixed" style="height:12px"></div>
<div class="ui-content" role="main">@RenderBody()</div>
<div data-role="footer" data-position="fixed" style="text-align:center;"></div>
</div>
</body>
投票页面:
@{
Layout = "~/Views/Shared/_Layout.Mobile.cshtml";
}
<script>
$('#star').raty({
number: 5,
path: '/Images',
size: 24,
width: 150,
click: function (score)
{
$("#Valor").val(score);
}
});
</script>
@using (Html.BeginForm("AvaliarOrador", "Mobile", FormMethod.Post, new { @id = "frmAvaliarOrador" }))
{
<input type="hidden" id="Valor" name="Valor" />
<div id="star" style="padding-top: 20px; padding-bottom: 10px; margin-left: auto; margin-right: auto; cursor: pointer; width: 170px"></div>
}
如果我刷新页面,星星就会消失,我必须再次返回主页,刷新并重新开始。