Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic change Background color

siegwin.portNov 28 2020

Hi,
I try to change the background color of a page depending on the size of the window.
In CSS Inline of the page I wrote
@media (max-width ≤640px) {
body {
background-color: red;
}
}
@media (min-width >640) and (max-width <768px) {
body {
background-color:yellow;
}
}
@media (min-width ≥768px) and (max-width <992px) {
body {
background-color:orange;
}
}
@media (min-width ≥992px) and (max-width <1200px) {
body {
background-color:green;
}
}
@media (min-width ≥1200px) {
body {
background-color: purple;
}
}
On Execute when page laods I wrote
apex.jQuery( window ).on('apexwindowresized', function() {
if ( apex.theme42.util.mq( '(min-width: 640px)' ) ) {
console.log( 'Window resized, and viewport is at least 640px wide' )
}
});
But I can change the size of the window, nothing happens the background is always white. but once the console .log is written when I use F12 Button
Thank you for your help
Regards
Siegwin

Comments
Post Details
Added on Nov 28 2020
1 comment
167 views