Click here to Skip to main content
15,886,805 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a div as
<div id="divMakeModelExist"  runat="server" 
               
               style="top: 300px; left: 600px; display:none; position:absolute;opacity: 0.7;">
      Make doesnt exist ??

     
    </div>

I am showing popup as
$("#divSectionExist").show();


My problem is that,I want the page should be disable with opacity when the popup is shown and enable when closed.
Posted

1 solution

You can do it.
Just add one id attribute to the div or table you want to change the opacity or disable, when popup is shown.
Then change its opacity according to popup's visibilty.
Something like below...
JavaScript
<div class="register" id="totalTable">
div contents goes here...
</div>
<div id="divMakeModelExist" runat="server" style="top: 300px; left: 600px; display:none; position:absolute;opacity: 0.7;"> Make doesnt exist ??
</div>

Now when you call the function to show popup like below...
JavaScript
$("#divSectionExist").show();

after this add codes to change the opacity of that div like...
JavaScript
$('#totalTable').css('opacity', '0.20');
$('#totalTable').css('filter', 'alpha(opacity=20)');
$('#totalTable').css('filter', '"alpha(opacity=20)"');

Here three lines of codes are written for cross browser compartibility.
Now when you call the function to hide that popup like below...
JavaScript
$("#divSectionExist").hide();

after that add codes to again change the opacity and come back to normal like...
JavaScript
$('#totalTable').css('opacity', '1');
$('#totalTable').css('filter', 'alpha(opacity=100)');
$('#totalTable').css('filter', '"alpha(opacity=100)"');

Refer one article Creating Popup Dialog Windows using JQuery[^] to know in details about the concepts.
You can Download Source Code[^] and check this demo[^] provided in that article.

Thanks...
Happy coding...:)
 
Share this answer
 
Comments
Pro Idiot 16-Nov-12 2:01am    
Good explanation , this should work
Thanks @Pro Idiot...
aassaahh 16-Nov-12 12:07pm    
thanks for you explanation
Any time, My pleasure...
Thanks for accepting the answer @aassaahh.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900