0

大家好,我搜索了很多,但我找不到解决问题的方法,我正在使用 jQuery mobile,我有一个元素data-role="page" and data-url="link"

现在我的问题是我的元素没有占据屏幕的整个宽度,就像用户放大到最大一样,这就是我想要的。我也设置<meta name="viewport" content="width=device-width, user-scalable=no">了但没有运气:(

请大家给我一个解决方案。

//LE

<?php get_header(); ?>
<?php $var1 = query_posts('post_type=Home Pages&meta_key=select_column_column&meta_value=Left');?>
 <?php if (have_posts($var1)) : ?>
     <?php while (have_posts()) : the_post(); ?>
     <?php $color = get_post_meta($post->ID,'select_color_color',true); ?>
                <article data-role="page" data-transition="slide">
                    <div class="sprite top-<?=$color?>"></div>
                    <div class="txt <?=$color?> clearfix">
                        <?php if(has_post_thumbnail()): ?>
                          <?php the_post_thumbnail('post-image'); ?>
                        <?php endif; ?>
                        <h2><?php the_title(); ?></h2>
                        <?php the_content(); ?>
                    </div>
                    <div class="sprite bottom-<?=$color?>"></div>
                </article>
        <?php endwhile; ?>
<?php endif; wp_reset_query();?>

<?php get_footer(); ?>


  $('article').bind("swipeleft", function(){
    var nextpage = $(this).next('article[data-role="page"]');
    // swipe using id of next page if exists
    if (nextpage.length > 0) {
      $.mobile.changePage(nextpage, {transition: "slide",
    reverse: false}, true, true);
    }
    $('article').unbind('swipeleft', nextpage);
  });

  $('article').bind("swiperight", function(){
    var prevpage = $(this).prev('article[data-role="page"]');
    if (prevpage.length > 0) {
    $.mobile.changePage(prevpage, {transition: "slide",
    reverse: true}, false, true);
    }
    $('article').unbind('swiperight', prevpage);
  });
4

2 回答 2

0

试试这个作为文档头中的视口标签:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

这应该设置一个确定的宽度并防止放大和缩小,允许您在 jQuery 中获取一个固定的宽度。

于 2013-02-16T17:31:38.627 回答
0

我是个白痴,看起来我的主图像有 224 像素,所以为了占据整个空间/宽度,它需要 400 像素以上

于 2013-02-16T19:28:05.137 回答