简体   繁体   中英

make jquery slidy slider width 100%

i am using this slider - > http://writerservices.us/slidy/ for your information.

I need to make slider width 100%, so in every resolution it stays 100%.

<script type="text/javascript">
        $(function() {

            $('#default').slidy();

            $('#pause').slidy({
                animation:  'mouseenter',
                cursor:     'wait',
                pause:      true
            });

            $('#menu').slidy({
                animation:  'slide',
                children:   'a',
                menu:       true,
                pause:      true,
                speed:      1100,
                time:       400001111111111111,
                width:      1300,
                height:     400
            });


            $('.group').slidy({
                animation:  'slide',
                height:     97,
                width:      240
            });

        });
    </script>

This is the html js code, there is variable width, bet when i write width: "100%" it doesn`t do what i want.

and html slider code looks like that

 <div id="menu">
   <a href="javascript:void(0);"><img src="img/image-2.jpg" title="Cargo handling"/></a>
 <a href="javascript:void(0);"><img src="img/image-3.jpg" title="Cargo charter flights"/></a>
 </div>

According to slidy's own documentation, the "width" option is to always be provided in pixels and never percentages ( https://github.com/wbotelhos/slidy ).

I would recommend using a different slider that supports percentage widths.

Use width:"100% !important"

<div id="default" style="width:100% !important;">
            <img src="img/image-1.jpg" style="width:100% !important;"/>
            <img src="img/image-2.jpg" style="width:100% !important;"/>
            <img src="img/image-3.jpg" style="width:100% !important;"/>
        </div

try this fiddle

    $('#menu').slidy({
        animation: 'slide',
        children: 'a',
        menu: true,
        pause: true,
        speed: 1100,
        time: 400001111111111111,
        width: $(document).width(),
        height: $(document).height()
    });

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