How do I center a horizontal control group in the footer - changed in jqm 1.1.1?

后端 未结 4 1580
野趣味
野趣味 2021-01-18 02:55

This used to work to center the controlgroup in 1.1.0, but now it seems like it doesn\'t in 1.1.1.

相关标签:
4条回答
  • 2021-01-18 03:02

    Issue still persists if using $("selector").show(); to display element since it applies 'display:block'.

    Instead of using .show(), now use $("selector").css('display', 'inline-block');

    0 讨论(0)
  • 2021-01-18 03:04

    I found the solution on this site: http://forum.jquery.com/topic/how-to-horizontally-center-a-set-of-grouped-buttons

    The CSS:

    #navgroup {text-align:center;}
    #navgroup div {display:inline-block;}
    

    The HTML:

    <div id="navgroup">
        <div data-role="controlgroup" data-type="horizontal">
          <a href="index.htm" data-role="button" data-theme="e" data-mini="true" class="active menu">Menu</a>
          <a href="specials.htm" data-role="button" data-theme="e" data-mini="true" class="specials">Specials</a>
          <a href="howitworks.htm" data-role="button" data-theme="e" data-mini="true" class="howitworks">FAQ</a>
          <a href="http://www.facebook.com" data-rel="external" data-role="button" data-theme="e" data-mini="true"  class="feedback">Facebook</a>
        </div>
    </div>
    
    0 讨论(0)
  • 2021-01-18 03:09

    Probably align="center" attribute of data-role="controlgroup" div could be suitable for that.

    <div data-theme="a" data-role="footer" align="center">
       <div data-role="controlgroup" data-type="horizontal" data-mini="true">
          <a href="foo" data-role="button">link1</a>
          <a href="boo" data-role="button">link2</a>
       </div>
       <div class="copy">&copy; 2012 bigco</div>
    </div>
    

    http://jsfiddle.net/sGFTy/1/

    0 讨论(0)
  • 2021-01-18 03:22

    Now I'm on JQM 1.2 and this works for me...

    CSS

    .center-controlgroup { text-align: center; }
    

    HTML

    <div data-role="controlgroup" data-type="horizontal" class="center-controlgroup">...</div>
    
    0 讨论(0)
提交回复
热议问题