how do i use a photo slide show inside listview?

前端 未结 1 1272
小鲜肉
小鲜肉 2021-01-27 01:00

how do i use a photo slide show inside listview??i am using jquery....the first row works fine..the pictures keep on looping...but in the next rows the pictures do not change..i

相关标签:
1条回答
  • 2021-01-27 01:48

    jQuery is only finding the first row in the list view marked with an id of slideshow. From http://api.jquery.com/id-selector/:

    For id selectors, jQuery uses the JavaScript function document.getElementById(), which is extremely efficient.

    Each id value must be used only once within a document. If more than one element has been assigned the same ID, queries that use that ID will only select the first matched element in the DOM. This behavior should not be relied on, however; a document with more than one element using the same ID is invalid.

    Try using a class instead to select your elements.

    I didn't try this, but just trying to get you in the right direction... change:

    <div id="slideshow">
    
        <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval ("Image1") %>' Width="250px" Height="190px" CssClass="active" />
        <asp:Image ID="Image5" runat="server" ImageUrl='<%# Eval ("Image2") %>' Width="250px" Height="190px" />
        <asp:Image ID="Image4" runat="server" ImageUrl='<%# Eval ("Image3") %>' Width="250px" Height="190px" />
    
    
    </div>
    

    to

    <div class="slideshow">
    
        <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval ("Image1") %>' Width="250px" Height="190px" CssClass="active" />
        <asp:Image ID="Image5" runat="server" ImageUrl='<%# Eval ("Image2") %>' Width="250px" Height="190px" />
        <asp:Image ID="Image4" runat="server" ImageUrl='<%# Eval ("Image3") %>' Width="250px" Height="190px" />
    
    
    </div>
    

    and anywhere your jquery has #slideshow to .slideshow

    0 讨论(0)
提交回复
热议问题