javascript - Jquery animate opacity and margin on other element -
i have link when clicked, has show 2 other links. when click link, nothing happends. nothing.
i have loaded in jquery before have script.
this jquery script:
$("#imd").toggle(function(){ $("#anw").animate({opacity:1},200); $("#3d").animate({margintop:75}, 200); },function(){ $("#anw").animate({opacity:0},200); $("#3d").animate({margintop:0}, 200); });
this css:
#anw { width: 50%; background-color: #0f0; opacity: 0; }
and html markup
<div class="mid"> <h1><a href="#anw" id="imd">interactive media design</a></h1> <div id="anw"><br><a class="left" href="website.html">apps</a><a class="right" href="website.html">websites</a></div> <hr> <h1 id="3d"><a href="#">3d modelling</h1> </div> <div class="bottom"> <h1><a href="3dsmax.html">contact , me</a></h1> </div>
my apologies if dumb question, have no clue.. documentation can find not filling needs.
you need work click
handler:
$("#imd").click(function(){ $("#anw").toggle(function(){ $(this).animate({opacity:1},200); }, function() { $(this).animate({opacity:0},200); }); $("#3d").toggle(function() { $(this).animate({margintop:75}, 200); },function() { $(this).animate({margintop:0}, 200); }) });
see fiddle: https://jsfiddle.net/8lpvty1w/
Comments
Post a Comment