Need help with Javascript/jQuery

3 replies
  • WEB DESIGN
  • |
    
#javascript or jquery
  • Profile picture of the author FraserJilani
    First I would recommend coding up the HTML of what you require with proper Classes and IDs so you can target the elements with Javascript.

    Basically for your first case you would set the hidden div to display:none;

    Lets say your hidden div has a class of .hidden and your button has a class of .button. Your code will be something like this:-

    Code:
    $(function(){
        $('.hidden').css({opacity:0}); //Use jQuery to set the opacity to 0
        $('.button').click(function(){
            $('.hidden').css({display : "block"}).stop(0,0).animate({opacity:1},500);
        });
    });
    The second one should follow the same principles if I understand your requirements correctly. It would help if you had the HTML code done already .
    {{ DiscussionBoard.errors[4709828].message }}
  • Profile picture of the author FraserJilani
    Dude that's a comment in my code explaining what I am doing with that line. The code is complete I'm not telling you to do anything extra. Perhaps you can link me to the live site and I will put your elements into the code above .
    {{ DiscussionBoard.errors[4710054].message }}
  • Profile picture of the author FraserJilani
    Yeah you will need to include the jQuery library.
    {{ DiscussionBoard.errors[4710915].message }}

Trending Topics