简体   繁体   English

Fittext在WordPress帖子上不起作用

[英]Fittext not working on WordPress Posts

I am trying to use fittext on the headers on my Worpress posts, but it is not working. 我试图在我的Worpress帖子的标题上使用fittext,但是它不起作用。

html HTML

<div class="row">
  <div class="col-md-12 textFit">
    <h2 id="fittext1"><a href="<?php the_permalink(); ?>" rel="bookmark">  <?php the_title(); ?></a></h2>
    <?php the_category(', '); ?>
  </div>    
</div>

footer.php (on output, js is brought in through functions - ) footer.php(在输出中,js通过函数引入-)

jquery is brought in through Wordpress in the head (enquened in functions.php ) jquery是通过Wordpress引入到头部的(在functions.php

<script type="text/javascript" src="http://localhost/wordpress/wp-content/themes/new/js/jquery.fittext.js"></script>

<script type="text/javascript">
 jQuery(document).ready(function() {

    jQuery("#fittext1").fitText(1.8, { minFontSize: '90px', maxFontSize: '150px' });
     });
</script>

css CSS

article h2 > a {    
  font-size: 90px;
  font-style: italic;
  font-weight: 800;
  line-height: 85px;
  letter-spacing: -.075em;
  color: #fff;
}

.textFit {
  display: block
  width: 100%;
}

This might help because I don't whether its works or not. 这可能会有所帮助,因为我不管它是否有效。 Just a Suggestion, try this one 只是一个建议,尝试这个

<script type="text/javascript">
    jQuery(document).ready(function($) 
    {
     $("#fittext1").fitText(1.8, { minFontSize: '90px',maxFontSize:'150px'});
    });
</script>

Check this for additional Info : jQuery.noConflict() 检查此其他信息: jQuery.noConflict()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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