开发者

onclick on link display only div, make other body balck or shaded

开发者 https://www.devze.com 2022-12-08 02:06 出处:网络
I have a page which has anchor tag clicking on which ma div tag toggles. I 开发者_StackOverflowwant to make whole body of page black or shaded except that Div tag.Well then you need to set body\'s bac

I have a page which has anchor tag clicking on which ma div tag toggles. I 开发者_StackOverflowwant to make whole body of page black or shaded except that Div tag.


Well then you need to set body's background color first and then your div's background. So make function toggle which would check for presence of class in both elements and then ether add or remove class attribute (for both elements) with $('#mydiv').addClass('foo') or $('#mydiv').removeClass('foo'). Then you can use CSS to declare background colors for body and then div: add class - color in, remove class - color out


It sounds like you really want a "Modal Dialog" type of display. There are a number of JQuery and other methods to do this.

Here is a good one that I've used before, Simple Modal

0

精彩评论

暂无评论...
验证码 换一张
取 消