简体   繁体   中英

Issue in displaying text over images in javascript image slider

Here is my HTML page:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8">
    <title>Demo slider</title>
    <link href="themes/1/js-image-slider.css" rel="stylesheet" type="text/css" />
    <script src="themes/1/js-image-slider.js" type="text/javascript"></script>

</head>
<body>
    <div id="sliderFrame">
        <div id="slider">
            <img src="images/image-slider-1.jpg" id="img1" alt="" />
            <img src="images/image-slider-2.jpg" id="img2" alt="" />
            <img src="images/image-slider-3.jpg" id="img3" alt="" />
            <img src="images/image-slider-4.jpg" id="img4" alt="" />
            <img src="images/image-slider-5.jpg" id="img5" alt="" />
        </div>
    </div>
    <div id="custom_text">
        <h1 style="color: blue;">Image 1 text</h1>
    </div>
    <div id="custom_text1">
        <h1 style="color: blue;">Image 2 text</h1>
    </div>
    <div id="custom_text2">
        <h1 style="color: blue;">Image 3 text</h1>
    </div>
    <div id="custom_text3">
        <h1 style="color: blue;">Image 4 text</h1>
    </div>
    <div id="custom_text4">
        <h1 style="color: blue;">Image 5 text</h1>
    </div>
</body>
</html>

Using menucool's Javascript Image Slider library: link to site

I want to display different text on different images i tried it giving absolute and relative positions to div and img tag but unable to acheive the output.

The javascript slider function is the predefined function.Basically i want to achieve this

This is why you always read the documentation:

http://www.menucool.com/javascript-image-slider#view2

Captions are set through each slide image's alt attribute. If the image is formatted as lazy loaded image, its caption can be defined by the title or data-alt attribute:

HTML

<img src="//placehold.it/250x250" id="img1" alt="Caption one" />
<img src="//placehold.it/249x249" id="img2" alt="Caption two" />
<img src="//placehold.it/251x251" id="img3" alt="Caption three" />
<img src="//placehold.it/248x248" id="img4" alt="Caption four" />
<img src="//placehold.it/252x252" id="img5" alt="Caption five" />

JSFiddle Demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM