Jquery Hover问题(适用于我的测试项目 - 不是主项目)

时间:2012-11-28 12:18:40

标签: jquery asp.net html jquery-ui jquery-plugins

我遇到了使用鼠标悬停的Jquery Hover的问题 - 我知道代码可以工作,因为我已经在我的测试网站上工作了(这只是一个前端测试网站...根本没有后端代码) 。我认为问题是在我的主站点中找不到元素 - 可能需要深入的脚本才能找到ID。

任何人都知道如何才能让它发挥作用?请参阅Jquery代码下面的代码: -

<script type="text/javascript">
   $(function () {
       var moveLeft = 20;
       var moveDown = 10;

       $('#trigger').hover(function (e) {
           $('div#pop-up').show()
  .css('top', e.pageY + moveDown)
  .css('left', e.pageX + moveLeft)
  .appendTo('body');
       }, function () {
           $('div#pop-up').hide();
       });

       $('#trigger').mousemove(function (e) {
           $("div#pop-up").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
       });

   });
</script>

以下是ASP HTML代码: -

<div class="profiledescriptions">
    <asp:Panel ID="pnlBizDescription" runat="server">

        <asp:Label CssClass="userdescription" ID="lblBizProfileAttributeID1" runat="server" Text=""></asp:Label>
        <div class="userlocation">
            <asp:Image ID="Image1" runat="server" ImageAlign="AbsMiddle" 
                ImageUrl="~/Images/IconShock Images/information_blue_16.png" />
            <asp:Literal ID="litBizCategory" runat="server"></asp:Literal>
            <span id="MainContent_Label1" class="comptitlelocationspacer">|</span>

            <asp:HyperLink ID="trigger" runat="server" CssClass="openingtimesBizprof" 
                ClientIDMode="Static">OPEN: Today 9:00-5:00PM</asp:HyperLink>

        </div>
        <div id="pop-up">
      <%--<h3>Pop-up div Successfully Displayed</h3>--%>
  <div class="popupstarratings">
      <table style="width: 90%;">
          <tr>
              <td class="style4">

                  Value</td>
              <td>
                  <img alt="" src="../Images/Stars/Small%20Stars/NEWSmallGoldStar3.png" 
                      align="bottom" /></td>
          </tr>
          <tr>
              <td class="style4">

                  Quality</td>
              <td>
                  <img alt="" src="../Images/Stars/Small%20Stars/NEWSmallGoldStar3.png" /></td>
          </tr>
          <tr>
              <td class="style4">

                  Reliability</td>
              <td>
                  <img alt="" src="../Images/Stars/Small%20Stars/NEWSmallGoldStar3.png" /></td>
          </tr>
          <tr>
              <td class="style4">
                  Customer Service</td>
              <td>
                  <img alt="" src="../Images/Stars/Small%20Stars/NEWSmallGoldStar3.png" /></td>
          </tr>
          <tr>
              <td class="style4">
                  Response Time</td>
              <td>
                  <img alt="" src="../Images/Stars/Small%20Stars/NEWSmallGoldStar3.png" /></td>
          </tr>
      </table>
  </div>
</div>
        <div class="userlocation">
            <asp:Image ID="imgBizLocation" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/Images/IconShock Images/location_16.png" />
            <asp:Literal ID="litBizZip" runat="server" />

        </div>


        <asp:Button ID="btnBizMessageMe" runat="server" CssClass="privateprofmsgbutton graymessagemebtn tempmessagemargin"
            PostBackUrl="~/Mail/NewMessage.aspx" Text="Message Me" Visible="false" />
            &nbsp;

        <asp:Button ID="btnBizFollowMe" runat="server" CssClass="addCompanybutton greenbtn "
            Text="Follow Company" BorderColor="#9ACD02" BorderStyle="Solid" BorderWidth="1px"
            ClientIDMode="Static" Visible="false" />
    </asp:Panel>


<div class="bizusernav2">
    <div id="profnavbar">
        <div id="wrapper">
            <ul class="checklist">
                <li class="fontbold">
                    <a id="Posts" class="graybarnavfonts profnavitempadding ">Posts</a></li>
                <li class="fontnormal">
                    <a class="graybarnavfonts profnavitempadding " id="About">About</a></li>
                <%--<li> <a href="_ToMerge/Prof_Reviews.aspx" class="graybarnavfonts profnavitempadding">Reviews</a></li>--%>
                <li class="fontnormal ">
                    <a class="graybarnavfonts profnavitempadding " id="Followers">Followers</a></li>
                <li class="fontnormal">
                    <a class="graybarnavfonts profnavitempadding " id="Contact">Contact Us</a></li>
            </ul>
        </div>
    </div>
</div>

<div id="PostsDiv" class="BusinessPosts">
    <asp:UpdatePanel ID="upBizFeeds" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
        <Triggers>
            <%--Only update this panel for itself and if a send button was click in the above panel--%>
            <%--<asp:AsyncPostBackTrigger ControlID="Buttonx" EventName="click" />--%>
        </Triggers>
        <ContentTemplate>
            <uc1:Feeds ID="ucFeeds" runat="server" CategoryID="8" />
        </ContentTemplate>
    </asp:UpdatePanel>
</div>

<div id="AboutDiv" class="BusinessAbout">
    <asp:Panel ID="pnlBizAboutMe" runat="server">
        <div class="compabouttitle">
            Who are we?
        </div>
        <div class="compintro">
            <asp:Label CssClass="" ID="lblBizProfileAttributeID2" runat="server" Text=""></asp:Label>
        </div>

        <div class="compabouttitle">
            Tags (Specialities) 
        </div>
        <div class="compabouttitle">
            <asp:Label CssClass="" ID="lblBizProfileAttributeID3" runat="server" Text=""></asp:Label>
        </div>

        <div class="compabouttitle">
            Contact Us
        </div>
        <div class="compaboutcontact">

            <table style="width: 40%;">
                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">
                            Phone:
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="litBizPhone" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">
                            E-Mail:
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="litBizEmail" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">
                            Website:
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Label CssClass="" ID="lblBizProfileAttributeID4" runat="server" Text=""></asp:Label>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </asp:Panel>
</div>

<div id="FollowersDiv" class="BusinessFollowers">
    <fieldset>
        <asp:Repeater ID="repFollowers" runat="server" OnItemDataBound="repFollowers_ItemDataBound">
            <ItemTemplate>
                <%--<Skriball:ProfileDisplay ShowFriendRequestButton="false" ShowDeleteButton="true" ID="pdProfileDisplay" runat="server" />--%>
                <Skriball:BusinessProfileDisplay ShowFollowerRequestButton="false" ShowFollowerDeleteButton="true" ID="pdBusinessProfileDisplay" runat="server" />
            </ItemTemplate>
        </asp:Repeater>
    </fieldset>
</div>

<div id="ContactDiv" class="BusinessContact">
    <div class="compabouttitle"> Location </div>
    <div class="compaboutcontact">

            <table style="width: 40%;">
                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">
                            Address:
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Addressline1" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">

                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="AddressLine2" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">

                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Town" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        &nbsp;</td>
                    <td>
                       <div class="compaboutcontactinfo">
                            <asp:Literal ID="County" runat="server" />
                        </div></td>
                </tr>

                <tr>
                    <td class="style1">
                        &nbsp;</td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Postcode" runat="server" />
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <div class="compabouttitle"> Contact Details </div>
    <div class="compaboutcontact">

            <table style="width: 40%;">
                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">
                            Phone:
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Literal1" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">
                            E-Mail:
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Literal2" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compaboutcontacttitle">
                            Website:
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Label CssClass="" ID="Label1" runat="server" Text=""></asp:Label>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="compabouttitle"> Opening Hours </div>
        <div class="compaboutcontact">

            <table style="width: 40%;">
                <tr>
                    <td class="style1">
                        <div class="compopentcontacttitle">
                            Monday
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Openingtimemon" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compopentcontacttitle">
                            Tuesday
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Literal3" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compopentcontacttitle">
                            Wednesday
                        </div>
                    </td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Literal4" runat="server" />
                        </div>
                    </td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compopentcontacttitle">
                            Thursday
                        </div></td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Literal5" runat="server" />
                        </div></td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compopentcontacttitle">
                            Friday
                        </div></td>
                    <td>
                      <div class="compaboutcontactinfo">
                            <asp:Literal ID="Literal6" runat="server" />
                        </div></td>
                </tr>

                <tr>
                    <td class="style1">
                        <div class="compopentcontacttitle">
                            Saturday
                        </div></td>
                    <td>
                       <div class="compaboutcontactinfo">
                            <asp:Literal ID="Literal7" runat="server" />
                        </div></td>
                </tr>

                <tr>
                    <td class="style1">
                       <div class="compaboutcontacttitle">
                            Sunday
                        </div></td>
                    <td>
                        <div class="compaboutcontactinfo">
                            <asp:Literal ID="Literal8" runat="server" />
                        </div></td>
                </tr>
            </table>
        </div>
</div>

我已经粘贴了HTML的整个部分,因为我认为这是找到元素的问题 - 如果有人想要我添加需要的部分让我知道!

由于

史蒂夫

&lt; ---------------来自Firebug的HTML代码--------------------&gt;

 <div id="Content_pnlBizDescription">
<span id="Content_lblBizProfileAttributeID1" class="userdescription">This is my company Slogan i wrote using teh MAnage Profile area.</span>
<div class="userlocation">
<img id="Content_Image1" align="absmiddle" src="../Images/IconShock%20Images/information_blue_16.png">
(Amusement/Entertainment)
<span id="MainContent_Label1" class="comptitlelocationspacer">|</span>
<a id="trigger" class="openingtimesBizprof">OPEN: Today 9:00-5:00PM</a>
</div>

0 个答案:

没有答案