固定导航栏在回发时消失

时间:2015-11-12 01:59:07

标签: javascript asp.net vb.net

我有一个导航栏,当用户向下滚动页面时应保持固定,但只要在页面上触发回发,该栏就会消失。

任何想法,如果有回发,我怎么能让酒吧保持固定?

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/master/main.Master" CodeBehind="BSCnclWrkOrd.aspx.vb" Inherits="METIS.BSCnclWrkOrd" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server">
    <script type="text/javascript" src="../jvs/jquery-1.11.3.min.js"></script>

    <script type="text/javascript">
        function pageLoad() {
            // Stick the #nav to the top of the window
            var nav = $('#nav');
            var navHomeY = nav.offset().top;
            var isFixed = false;
            var $w = $(window);
            $w.scroll(function () {
                var scrollTop = $w.scrollTop();
                var shouldBeFixed = scrollTop > navHomeY;
                if (shouldBeFixed && !isFixed) {
                    nav.css({
                        position: 'fixed',
                        top: 0,
                        left: nav.offset().left,
                        width: nav.width(),
                        zIndex: "50",
                        boxShadow: "0 2px 1px 0 rgba(179,179,179,0.8)"
                    });
                    isFixed = true;
                }
                else if (!shouldBeFixed && isFixed) {
                    nav.css({
                        position: 'static',
                        boxShadow: "0 0 0 0"
                    });
                    isFixed = false;
                }
            });
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="cphContent" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table align="center" style="width: 100%;" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="pagetitle">
                        <div id="wrap">
                            <div id="header">
                                <div id="navWrap">
                                    <div id="nav">
                                        <table style="width: 100%" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td align="left" style="font-size: 25px; letter-spacing: 1px; color: #1586a2; width: 579px; padding: 7px 0 7px 0">
                                                    <asp:Label ID="Label3" runat="server" Text="View / Cancel Work Order"></asp:Label>
                                                </td>
                                                <td id="Td1" style="width: 400px">
                                                    <div style="float: right; padding: 3px 0 3px 0">
                                                        <asp:ImageButton ID="ibtnUpdate" runat="server" ImageAlign="Middle" ImageUrl="~/images/btnUpdate.png"
                                                            Style="padding: 5px;" ToolTip="Cancel work order" />
                                                        <cc1:ConfirmButtonExtender ID="ibtnUpdate_ConfirmButtonExtender" runat="server" BehaviorID="ibtnUpdate_ConfirmButtonExtender" ConfirmText="Are you sure you want to cancel the selected work order(s)?" TargetControlID="ibtnUpdate" />
                                                        <asp:ImageButton ID="ibtnRefresh" runat="server" ImageAlign="Middle" ImageUrl="~/images/btnRefresh.png"
                                                            Style="padding: 5px;" ToolTip="Refresh" />
                                                        </asp:DropDownList>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

1 个答案:

答案 0 :(得分:1)

你可以尝试这个吗? 在内容标记

之后将其添加到您的代码中
execl(params[0].c_str(), params[1].c_str(), 0);