Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • phillypro Friend
    #160937

    Basically…i have a jquery command

    <script type="text/javascript">
    $(document).ready(function() {
    $('body').css('cursor', 'pointer');

    $('body').click(function(event) {
    if (event.target == event.currentTarget)
    window.open('http://www.google.dk');
    });

    $('div#gk-wrapper').hover(function() {
    $('body').css('cursor', 'auto');
    }, function() {
    $('body').css('cursor', 'pointer');
    });
    });
    </script>

    Which should work fine considering JAComment loads jquery 1.4.2 ….but it doesnt….it only works when i add this line of code right above it <
    script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
    Why is it that this happens??…what can i do to make my line of code work?

    nghiatd Friend
    #379754

    Hello,

    The jquery command don’t run because joomla use mootool Library.
    Jquery and mootool will be conflict if you use them in a site.
    Please read this guide to use jquery in joomla site with mootool to avoice conflicting
    http://docs.jquery.com/Using_jQuery_with_Other_Libraries

    You can edit this code to:
    change
    $(document).ready(function() {
    to
    jQuery(document).ready(function($){
    And here is result:

    <script type="text/javascript">
    jQuery(document).ready(function($){
    $('body').css('cursor', 'pointer');

    $('body').click(function(event) {
    if (event.target == event.currentTarget)
    window.open('http://www.google.dk');
    });

    $('div#gk-wrapper').hover(function() {
    $('body').css('cursor', 'auto');
    }, function() {
    $('body').css('cursor', 'pointer');
    });
    });
    </script>

    Best Regards.

Viewing 2 posts - 1 through 2 (of 2 total)

This topic contains 2 replies, has 2 voices, and was last updated by  nghiatd 13 years, 8 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum