带有动态加载图像的jquery的循环内容轮播

时间:2013-01-24 06:36:22

标签: jquery asp.net

我正在使用asp.net和Jquery。

我的应用程序中有一个带有jquery 的循环内容轮播<静态图像(即)我手动将图像插入css.But我需要使用sqlserver 动态 strong>数据库。请给出一些建议。

CODE:

   .ca-item-2 .ca-icon
   {
     background-image:url(../Database/images/f1.jpg);
   }

这是我现在插入图片的方式。

这是工作代码

      <div class="container">
        <div class="header">
            <a                 href="http://tympanus.net/Tutorials/PortfolioImageNavigation/"><span>&laquo; Previous Demo: </span>Portfolio Image Navigation</a>
            <span class="right_ab">
                <a href="http://cyberella74.deviantart.com/art/Archigraphs-Animals-Icons-139629985" target="_blank">Animal Icons by Cyberella</a>
                <a href="http://tympanus.net/codrops/2011/08/16/circular-content-carousel/"><strong>back to the Codrops post</strong></a>
            </span>
        </div>
        <h1>Circular Content Carousel<span>with jQuery</span></h1>
        <div id="ca-container" class="ca-container">
            <div class="ca-wrapper">
                <div class="ca-item ca-item-1">
                    <div class="ca-item-main">
                        <div class="ca-icon"></div>
                        <!--<h3>Stop factory farming</h3>
                        <h4>
                            <span class="ca-quote">&ldquo;</span>
                            <span>The greatness of a nation and its moral progress can be judged by the way in which its animals are treated.</span>
                        </h4>-->
                            <a href="#" class="ca-more">more...</a>
                    </div>
                    <div class="ca-content-wrapper" runat="server">
                        <div class="ca-content">
                            <h6>Animals are not commodities</h6>
                            <a href="#" class="ca-close">close</a>
                            <div class="ca-content-text">
                                <p>I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.</p>
                                <!--<p>When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream;</p>
                                <p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>-->
                            </div>
                            <ul>
                                <li><a href="#">Read more</a></li>
                                <li><a href="#">Share this</a></li>
                                <li><a href="#">Become a member</a></li>
                                <li><a href="#">Donate</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ca-item ca-item-2">
                    <div class="ca-item-main">
                        <div class="ca-icon"></div>
                        <!--<h3>Respect Life &amp; Rights</h3>
                        <h4>
                            <span class="ca-quote">&ldquo;</span>
                            <span>I hold that the more helpless a creature, the more entitled it is to protection by man from the cruelty of man.</span>
                        </h4>-->
                            <a href="#" class="ca-more">more...</a>
                    </div>
                    <div id="ca-content-wrapper">
                        <div id="ca-content">
                            <h6>Would you eat your dog?</h6>
                            <a href="#" id="ca-close">close</a>
                            <div id="ca-content-text">
                                <p>I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.</p>
                                <!--<p>When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream;</p>
                                <p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>-->
                            </div>
                            <ul>
                                <li><a href="#">Read more</a></li>
                                <li><a href="#">Share this</a></li>
                                <li><a href="#">Become a member</a></li>
                                <li><a href="#">Donate</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div id="ca-item ca-item-3">
                    <div id="ca-item-main">
                        <div id="ca-icon"></div>
                        <!--<h3>Become 100% meat-free</h3>
                        <h4>
                            <span id="ca-quote">&ldquo;</span>
                            <span>I feel that spiritual progress does demand at some stage that we should cease to kill our fellow creatures for the satisfaction of our bodily wants.</span>
                        </h4>-->
                            <a href="#" id="ca-more">more...</a>
                    </div>
                    <div id="ca-content-wrapper">
                        <div id="ca-content">
                            <h6>You can change the world</h6>
                            <a href="#" id="ca-close">close</a>
                            <div id="ca-content-text">
                                <p>I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.</p>
                                <!--<p>When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream;</p>
                                <p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>-->
                            </div>
                            <ul>
                                <li><a href="#">Read more</a></li>
                                <li><a href="#">Share this</a></li>
                                <li><a href="#">Become a member</a></li>
                                <li><a href="#">Donate</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ca-item ca-item-4">
                    <div class="ca-item-main">
                        <div class="ca-icon"></div>
                        <!--<h3>Make a difference</h3>
                        <h4>
                            <span id="ca-quote">&ldquo;</span>
                            <span>A man is but the product of his thoughts what he thinks, he becomes.</span>
                        </h4>-->
                            <a href="#" class="ca-more">more...</a>
                    </div>
                    <div class="ca-content-wrapper">
                        <div class="ca-content">
                            <h6>Think globally, act locally</h6>
                            <a href="#" class="ca-close">close</a>
                            <div class="ca-content-text">
                                <p>I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.</p>
                                <!--<p>When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream;</p>
                                <p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>-->
                            </div>
                            <ul>
                                <li><a href="#">Read more</a></li>
                                <li><a href="#">Share this</a></li>
                                <li><a href="#">Become a member</a></li>
                                <li><a href="#">Donate</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ca-item ca-item-5">
                    <div class="ca-item-main">
                        <div class="ca-icon"></div>
                        <!--<h3>Say no to killing</h3>
                        <h4>
                            <span class="ca-quote">&ldquo;</span>
                            <span>A weak man is just by accident. A strong but non-violent man is unjust by accident.</span>
                        </h4>-->
                            <a href="#" class="ca-more">more...</a>
                    </div>
                    <div class="ca-content-wrapper">
                        <div class="ca-content">
                            <h6>Animals have rights, too!</h6>
                            <a href="#" class="ca-close">close</a>
                            <div class="ca-content-text">
                                <p>I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.</p>
                                <!--<p>When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream;</p>
                                <p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>-->
                            </div>
                            <ul>
                                <li><a href="#">Read more</a></li>
                                <li><a href="#">Share this</a></li>
                                <li><a href="#">Become a member</a></li>
                                <li><a href="#">Donate</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ca-item ca-item-6">
                    <div class="ca-item-main">
                        <div class="ca-icon"></div>
                        <!--<h3>Don't believe the lies</h3>
                        <h4>
                            <span class="ca-quote">&ldquo;</span>
                            <span>An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it.</span>
                        </h4>-->
                            <a href="#" class="ca-more">more...</a>
                    </div>
                    <div class="ca-content-wrapper">
                        <div class="ca-content">
                            <h6>How essential is meat?</h6>
                            <a href="#" class="ca-close">close</a>
                            <div class="ca-content-text">
                                <p>I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.</p>
                                <!--<p>When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream;</p>
                                <p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>-->
                            </div>
                            <ul>
                                <li><a href="#">Read more</a></li>
                                <li><a href="#">Share this</a></li>
                                <li><a href="#">Become a member</a></li>
                                <li><a href="#">Donate</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ca-item ca-item-7">
                    <div class="ca-item-main">
                        <div class="ca-icon"></div>
                        <!--<h3>Save the planet</h3>
                        <h4>
                            <span class="ca-quote">&ldquo;</span>
                            <span>A small body of determined spirits fired by an unquenchable faith in their mission can alter the course of history.</span>
                        </h4>-->
                            <a href="#" class="ca-more">more...</a>
                    </div>
                    <div class="ca-content-wrapper">
                        <div class="ca-content">
                            <h6>Collateral damage?</h6>
                            <a href="#" class="ca-close">close</a>
                            <div class="ca-content-text">
                                <p>I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.</p>
                                <!--<p>When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream;</p>
                                <p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>-->
                            </div>
                            <ul>
                                <li><a href="#">Read more</a></li>
                                <li><a href="#">Share this</a></li>
                                <li><a href="#">Become a member</a></li>
                                <li><a href="#">Donate</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="ca-item ca-item-8">
                    <div class="ca-item-main">
                        <div class="ca-icon"></div>
                        <!--<h3>It's time to move on</h3>
                        <h4>
                            <span class="ca-quote">&ldquo;</span>
                            <span>A nation's culture resides in the hearts and in the soul of its people.</span>
                        </h4>-->
                            <a href="#" class="ca-more">more...</a>
                    </div>
                    <div class="ca-content-wrapper">
                        <div class="ca-content">
                            <h6>Let's finally become humans</h6>
                            <a href="#" class="ca-close">close</a>
                            <div class="ca-content-text">
                                <p>I am so happy, my dear friend, so absorbed in the exquisite sense of mere tranquil existence, that I neglect my talents. I should be incapable of drawing a single stroke at the present moment; and yet I feel that I never was a greater artist than now.</p>
                                <!--<p>When, while the lovely valley teems with vapour around me, and the meridian sun strikes the upper surface of the impenetrable foliage of my trees, and but a few stray gleams steal into the inner sanctuary, I throw myself down among the tall grass by the trickling stream;</p>
                                <p>She packed her seven versalia, put her initial into the belt and made herself on the way.</p>-->
                            </div>
                            <ul>
                                <li><a href="#">Read more</a></li>
                                <li><a href="#">Share this</a></li>
                                <li><a href="#">Become a member</a></li>
                                <li><a href="#">Donate</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <h5>Quotes by Mohandas Gandhi</h5>
    </div>

2 个答案:

答案 0 :(得分:2)

使用转发器并使用jQuery轮播插件(如jCarouselLite)创建圆形转盘,最好将图像插入页面本身。

答案 1 :(得分:0)

使用PHP和数据库连接;我得到了你想要的东西。

查询:(应该根据数据库的工作方式调整sql查询)

   $sth = $dbh->prepare("SELECT * FROM Carousel");
    $sth->execute();
    $carousel = $sth->fetchAll(PDO::FETCH_ASSOC);

这是PHP:

(您必须在标签[&#39; ID&#39;]等之间命名数据库中的表名。)

<div class="container">
    <div id="ca-container" class="ca-container">
        <div class="ca-wrapper">
        <? foreach ($carousel as $carouselrow) { ?>
            <div class="ca-item ca-item-<? echo $carouselrow['ID']; ?>">
                <div class="ca-item-main">
                    <div class="ca-icon" style="background-image:url('<? echo $carouselrow['Image']; ?>')"></div>
                    <h3><? echo $carouselrow['Title']; ?></h3>
                    <h4>
                        <span class="ca-quote">&ldquo;</span>
                        <span><? echo $carouselrow['Subtitle']; ?></span>
                    </h4>
                    <a href="#" class="ca-more">Lees meer...</a>
                </div>
                <div class="ca-content-wrapper">
                    <div class="ca-content">
                        <h6><? echo $carouselrow['Title']; ?></h6>
                        <a href="#" class="ca-close">Sluit</a>
                        <div class="ca-content-text">
                            <p><? echo $carouselrow['Content']; ?></p>
                        </div>
                    </div>
                </div>
            </div>                                        
        <? } ?>
    </div>
</div>