Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Can’t get simple jQuery working in WP

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29815
    kip1790
    Member

    Trying to use Fancybox jQuery to load up URLs in an iFrame, not the actual WP Fancybox plugin. I got the code from fancybox.net and when I load it outside of my theme folder it works fine. When I copy the exact code into my Header as below and link to the JS files it loads Google in the full page as opposed to loading up Google in the fancybox. Tried everything, really need some guidance please…

    Code:



    <?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?>


    This is the link I use to test it out

    Code:

    I have a jQuery contact form on the same page and that works fine. I stripped that out to avois any conflicts, also didn’t work. If I put the index.html file that comes with fancybox into my wordpress folder it works great, but when i copy the code across it didn’t. Thought it might be my theme so tried it in default and another theme and still no luck.

    Any help would be much appreciated.

    #80835
    jamygolden
    Member
    Quote:
    <?php wp_enqueue_script("jquery"); ?>
    <script type=’text/javascript’ src=’http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js’></script&gt; <!– jQuery –>

    That looks like you would be loading 2 jQuery scripts. Check in the source once the page has loaded. If so, remove one of them.

    Try removing ‘$j=jQuery.noConflict();’ and see what happens. So the javascript should look like this.

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

    $("#various3").fancybox({
    ‘width’ : ‘75%’,
    ‘height’ : ‘75%’,
    ‘autoScale’ : false,
    ‘transitionIn’ : ‘none’,
    ‘transitionOut’ : ‘none’,
    ‘type’ : ‘iframe’
    });

    });
    </script>

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.