1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to get this slider to fit better in iPhone screen

Discussion in 'jQuery' started by chrisj, Aug 26, 2016.

  1. #1
    I've installed a simple slider
    and the slider appears on the page successfully in my pc. I have this:

    
        <script>
        $(function(){
          var slider = new BSlider({
            structure: {
              container: {
                id: "my-slider",
                width: 1220,
                height: 420,
              }
            },
            content: {
              images: [
                "img/img1.png",
                "img/img2.png",
                "img/img3.png",
              ]
            },
            animation: {
              effects: effectSets["slider: big set 2"],
              interval: 9800
            }
          });
        });
        </script>
     
    Code (markup):
    What do I add so that the width fits an iPhone screen?

    I look forward to any help, thanks
     
    chrisj, Aug 26, 2016 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You either find a slider that doesn't set the width in px, or you change the CSS/code, or you remove the width and height and set those in CSS in either EM or %, and add @media-queries to cater for different screen sizes.
     
    PoPSiCLe, Aug 26, 2016 IP
  3. chrisj

    chrisj Well-Known Member

    Messages:
    606
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    Thanks for your reply.
    I've tried this in the header:

    
    <link rel="stylesheet" type="text/css" href="css/demoX.css"/>
    <link rel="stylesheet" type="text/css" media="screen" href="css/demoY.css"/>
    Code (markup):
    and I can now adjust the width for iPhone with this in demoY.css:

    #my-slider {
    width:100%;
    max-width: 970px;
    height: 0 auto;
    overflow:hidden;
    border: 5px solid #ff0000;
    }
    Code (markup):
    But demoX.css is not affecting the pc width:

    #my-slider {
    width:100%;
    max-width: 1220px;
    height: 0 auto;
    overflow:hidden;
    border: 5px solid #ff0000;
    }
    Code (markup):
    on the pc, it shows what is reflected in demoY.css (which isn't wide enough on the pc screen).

    any suggestion?
     
    chrisj, Aug 26, 2016 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Eh, yes. Read up on @media queries in css. Of course what you have there won't work, you can't have different css files for different screens (well, you CAN, but it's not in any way smart)
     
    PoPSiCLe, Aug 27, 2016 IP