tags - fadeto jquery function on all page but few (tagged) elements -
i using simple script on webpage:
<script> $(document).ready(function(){ $("notowned").fadeto(2000,0.2,function(){ }); }); </script>
so elements (images) under "notowned" tag grayed out. however, quite counter-intuitive programs pages that, wanted reverse: fade out elements , add "owned" tags should not grayed out. tried various ways, making 2 tags, did not work. can me that? thanks!
edit: here jfiddle link http://jsfiddle.net/4tkh6/ note have on 118 elements, want them grayed out default , "ungrey" of them tag or something. afaik fadetoggle removes them not me.
<notowned>
tag not standard tag neither in html5, don't use it.
use standard elements <div>
, if need 'em special assign custom data-*
attribute purpose:
<div data-owned="0">image 1</div> <div data-owned="1">image 2</div> <div data-owned="0">image 3</div> <div data-owned="0">image 4</div> <div data-owned="0">image 5</div>
css example:
[data-owned='0']{ opacity: 0.3; } [data-owned='1']{ opacity: 1 ; }
js/jq toggle data state example:
$('[data-owned]').click(function(){ this.dataset.owned ^= 1; // toggle 0/1 });
Comments
Post a Comment