Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Inmedia 124 posts 176 karma points
    Mar 24, 2011 @ 10:37
    Inmedia
    0

    Need Java Script help...

    Hi guys

    I have a script that tells how a hover animation (opacity) should work on specific images. The images should be 50% opacity by default and then go 100% opacity on hover and back to 50% on mouse out.

    I got the "hover" and "mouse out" funktions working, but I don't know how to tell it to set the images to 50% opacity when page loads...

    My script looks like this:

     

    <script type="text/javascript">
      var J = jQuery.noConflict();
      J(document).ready(function(){
        //Portfolio hover
        J(".portfolio-item img, .image-nav img").hover(
          function() {
          J(this).animate({"opacity": "1"}, "slow");
          },
        
            function() {
          J(this).animate({"opacity": "0.5"}, "slow");
          });

     

    I have very little Java script experience, but I think this should be fairly easy to accomplish by adding something to the script above... I need it to tell all IMG in "Portfolio-item" to be 50% opacity.

    Can someone please help me?

     

    // Mikkel


  • Peter Nielsen 159 posts 257 karma points
    Mar 24, 2011 @ 10:42
    Peter Nielsen
    0

    Hi Mikkel,

    I think you are in the wrong forum. This has nothing to do with Umbraco but is simple jQuery. And it not a job offer you are giving, so also the wrong section in here.

    But an answer could be something like

     

    $(".portfolio-item img").css({ opacity: 0.5 });

     

    Just under the ready function

    /Peter

     

  • Inmedia 124 posts 176 karma points
    Mar 24, 2011 @ 10:47
    Inmedia
    0

    Yes, I know... But I didn't know which section to post it under.

    And I thought people maybe would help me out even though it has nothing specific to do with umbraco... And I guess I was right :)

    That solved it... Thank you very much, Peter :)

     

    // Mikkel

  • Pasang Tamang 258 posts 458 karma points
    Mar 24, 2011 @ 10:49
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies