简体   繁体   中英

jQuery slideToggle Hide / Show Issues

I am having a couple problems trying to manually insert some jQuery features into a wordpress theme. I have a lightbox wordpress plugin that is jQuery based that is working fine.

So if I manually load the jQuery script into wordpress the functions seem to work but instead of say a slide being hidden it is revealed when it should still be hidden. Or a pop up that should work is already being shown instead of hidden. I don't think I'm supposed to manually include the jQuery into my skin but using the wp_enqueue_script('jquery'); doesn't seem to be resolving my issues either.

<script src="http://platform.twitter.com/anywhere.js?id=i5CnpkmwnlWpDdAZGVpxw&v=1" type="text/javascript"></script>

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

    $(".btn-slide").click(function(){
      $("#twitpanel").slideToggle("slow");
      $(this).toggleClass("active");
    });

});
</script>

<div id="tweetit"><a class="btn-slide">Tell em'</a>
            <div id="twitpanel"></div>
            <script type="text/javascript">

              twttr.anywhere(function (T) {

                T("#twitpanel").tweetBox({
                  height: 100,
                  width: 225,
                  defaultContent: "Some Random Text"
                });

              });

            </script>

            </div></h2>

Like I said it works but in the reverse fashion that it should be.

I think I'm just loading in something wrong?

TIA, Chase

maybe you need to default the div to hidden?

<div id="twitpanel" style="display:none"></div>

or

<div id="twitpanel" style="visibility:hidden"></div>

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