html - How to make DIV constantly display text on click? -
i want way (ideally using css html) when click on question, text shows , remains there. if click on text again, revert question.
it works on hover, don't know how make on click. html:
<div id="packagequestioninfo"> <p class="packagereplies">question</p> <p class="packagecomment">if require <b>hosting</b> website, select primary website , go <b>part ii</b>. if not require hosting, please checkout below. </p> </div> css:
#packagequestioninfo { padding: 10px; background: #f2f7fa; border-radius: 0px; -moz-box-shadow: 0 0 5px #ccc; -webkit-box-shadow: 0 0 5px #ccc; box-shadow: 0 0 5px #ccc; } #packagequestioninfo:hover { background-image:url(../img/index/body/ourproducts/light_blue_background_pattern.jpg); background-repeat:repeat; cursor: none; } #packagequestioninfo .packagecomment { display: none; } #packagequestioninfo:hover .packagereplies { display: none; } #packagequestioninfo:hover .packagecomment { display: inline; } here code http://jsfiddle.net/53uk2/
make .packagecomment invinsible css, use jquery:
$('p').click(function(){ $('p').toggle(); }); fiddle: http://fiddle.jshell.net/rctgn/
Comments
Post a Comment