How to add media-rules dynamically to a element2019 Community Moderator ElectionjQuery CSS - Write into the <style>-tagHow do JavaScript closures work?How do I detect a click outside an element?Add table row in jQueryHow do I check if an element is hidden in jQuery?Event binding on dynamically created elements?How do I redirect to another webpage?How to disable text selection highlighting?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?jQuery scroll to element
Fourth person (in Slavey language)
Single word request: Harming the benefactor
Reverse string, can I make it faster?
Does "variables should live in the smallest scope as possible" include the case "variables should not exist if possible"?
Logic. Truth of a negation
What to do when during a meeting client people start to fight (even physically) with each others?
Accountant/ lawyer will not return my call
Time travel short story where dinosaur doesn't taste like chicken
A question on the ultrafilter number
PTIJ: How can I halachically kill a vampire?
What is the chance of making a successful appeal to dismissal decision from a PhD program after failing the qualifying exam in the 2nd attempt?
Grey hair or white hair
BitNot does not flip bits in the way I expected
Who deserves to be first and second author? PhD student who collected data, research associate who wrote the paper or supervisor?
Replacing Windows 7 security updates with anti-virus?
Solving "Resistance between two nodes on a grid" problem in Mathematica
They call me Inspector Morse
Why does Captain Marvel assume the planet where she lands would recognize her credentials?
Why the color red for the Republican Party
Can't find the Shader/UVs tab
How do I express some one as a black person?
Finding algorithms of QGIS commands?
Why doesn't this Google Translate ad use the word "Translation" instead of "Translate"?
Why would one plane in this picture not have gear down yet?
How to add media-rules dynamically to a element
2019 Community Moderator ElectionjQuery CSS - Write into the <style>-tagHow do JavaScript closures work?How do I detect a click outside an element?Add table row in jQueryHow do I check if an element is hidden in jQuery?Event binding on dynamically created elements?How do I redirect to another webpage?How to disable text selection highlighting?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?jQuery scroll to element
I want to add some media-rules flexible to some of the elements in a website. If I click an element a kind of toolbar will be opened to change the css-styles for a specific media-rule. So far so good...
My first idea was simple, to do it with inline-style but media rules could not use in inline-style.
So I have to look for another way how I can add dynamically this rules.
Maybe I create a new style-set dynamicalls.
<style>
@media screen and (min-width:920px)
@media screen and (min-width:720px)
@media screen and (max-width:580px)
</style>
But, I don't know...
1) How I can add new classes exactly to this new style-set (I have other style-declaration, and all in the style-tag without a id to use as a selector.)
2) If I find a way to select this style-set, how can I put the new classes into the wanted media rule - wich kind of selector I have to use?
As an example, I want to add this new class ".newclassfont-size:12px;"
to the media ruls "min-width:920px
"
$("UNKOWN_SELECTOR").html/append/something_else("
.newclass
font-size: 12px;
")
.appendTo("UNKONWN_SECOND_SELECTOR_TO_MEDIARULE");
At the end I want to have this result
<style>
@media screen and (min-width:920px) .newclassfont-size:12px;
@media screen and (min-width:720px)
@media screen and (max-width:580px)
</style>
I hope someone can tell me a easier way, to solve this.
thanks a lot.
javascript php jquery css
add a comment |
I want to add some media-rules flexible to some of the elements in a website. If I click an element a kind of toolbar will be opened to change the css-styles for a specific media-rule. So far so good...
My first idea was simple, to do it with inline-style but media rules could not use in inline-style.
So I have to look for another way how I can add dynamically this rules.
Maybe I create a new style-set dynamicalls.
<style>
@media screen and (min-width:920px)
@media screen and (min-width:720px)
@media screen and (max-width:580px)
</style>
But, I don't know...
1) How I can add new classes exactly to this new style-set (I have other style-declaration, and all in the style-tag without a id to use as a selector.)
2) If I find a way to select this style-set, how can I put the new classes into the wanted media rule - wich kind of selector I have to use?
As an example, I want to add this new class ".newclassfont-size:12px;"
to the media ruls "min-width:920px
"
$("UNKOWN_SELECTOR").html/append/something_else("
.newclass
font-size: 12px;
")
.appendTo("UNKONWN_SECOND_SELECTOR_TO_MEDIARULE");
At the end I want to have this result
<style>
@media screen and (min-width:920px) .newclassfont-size:12px;
@media screen and (min-width:720px)
@media screen and (max-width:580px)
</style>
I hope someone can tell me a easier way, to solve this.
thanks a lot.
javascript php jquery css
Why forcing media rules without changing media? You can toggle class name of element using jqueryaddClass
andremoveClass
– Ali Sheikhpour
Mar 7 at 8:00
at the beginning i have no mediarules, i want to add them by need
– mikeD
Mar 7 at 8:01
@mikeD what is the reason for doing it this way? Its seems to be going about it backwards - media queries let you define the rules so they are automatically applied... You're not just adding extra processing, but you're doing it on the client side which will slow down the page.
– FluffyKitten
Mar 7 at 8:50
add a comment |
I want to add some media-rules flexible to some of the elements in a website. If I click an element a kind of toolbar will be opened to change the css-styles for a specific media-rule. So far so good...
My first idea was simple, to do it with inline-style but media rules could not use in inline-style.
So I have to look for another way how I can add dynamically this rules.
Maybe I create a new style-set dynamicalls.
<style>
@media screen and (min-width:920px)
@media screen and (min-width:720px)
@media screen and (max-width:580px)
</style>
But, I don't know...
1) How I can add new classes exactly to this new style-set (I have other style-declaration, and all in the style-tag without a id to use as a selector.)
2) If I find a way to select this style-set, how can I put the new classes into the wanted media rule - wich kind of selector I have to use?
As an example, I want to add this new class ".newclassfont-size:12px;"
to the media ruls "min-width:920px
"
$("UNKOWN_SELECTOR").html/append/something_else("
.newclass
font-size: 12px;
")
.appendTo("UNKONWN_SECOND_SELECTOR_TO_MEDIARULE");
At the end I want to have this result
<style>
@media screen and (min-width:920px) .newclassfont-size:12px;
@media screen and (min-width:720px)
@media screen and (max-width:580px)
</style>
I hope someone can tell me a easier way, to solve this.
thanks a lot.
javascript php jquery css
I want to add some media-rules flexible to some of the elements in a website. If I click an element a kind of toolbar will be opened to change the css-styles for a specific media-rule. So far so good...
My first idea was simple, to do it with inline-style but media rules could not use in inline-style.
So I have to look for another way how I can add dynamically this rules.
Maybe I create a new style-set dynamicalls.
<style>
@media screen and (min-width:920px)
@media screen and (min-width:720px)
@media screen and (max-width:580px)
</style>
But, I don't know...
1) How I can add new classes exactly to this new style-set (I have other style-declaration, and all in the style-tag without a id to use as a selector.)
2) If I find a way to select this style-set, how can I put the new classes into the wanted media rule - wich kind of selector I have to use?
As an example, I want to add this new class ".newclassfont-size:12px;"
to the media ruls "min-width:920px
"
$("UNKOWN_SELECTOR").html/append/something_else("
.newclass
font-size: 12px;
")
.appendTo("UNKONWN_SECOND_SELECTOR_TO_MEDIARULE");
At the end I want to have this result
<style>
@media screen and (min-width:920px) .newclassfont-size:12px;
@media screen and (min-width:720px)
@media screen and (max-width:580px)
</style>
I hope someone can tell me a easier way, to solve this.
thanks a lot.
javascript php jquery css
javascript php jquery css
edited Mar 7 at 8:25
koo
29213
29213
asked Mar 7 at 7:55
mikeDmikeD
858
858
Why forcing media rules without changing media? You can toggle class name of element using jqueryaddClass
andremoveClass
– Ali Sheikhpour
Mar 7 at 8:00
at the beginning i have no mediarules, i want to add them by need
– mikeD
Mar 7 at 8:01
@mikeD what is the reason for doing it this way? Its seems to be going about it backwards - media queries let you define the rules so they are automatically applied... You're not just adding extra processing, but you're doing it on the client side which will slow down the page.
– FluffyKitten
Mar 7 at 8:50
add a comment |
Why forcing media rules without changing media? You can toggle class name of element using jqueryaddClass
andremoveClass
– Ali Sheikhpour
Mar 7 at 8:00
at the beginning i have no mediarules, i want to add them by need
– mikeD
Mar 7 at 8:01
@mikeD what is the reason for doing it this way? Its seems to be going about it backwards - media queries let you define the rules so they are automatically applied... You're not just adding extra processing, but you're doing it on the client side which will slow down the page.
– FluffyKitten
Mar 7 at 8:50
Why forcing media rules without changing media? You can toggle class name of element using jquery
addClass
and removeClass
– Ali Sheikhpour
Mar 7 at 8:00
Why forcing media rules without changing media? You can toggle class name of element using jquery
addClass
and removeClass
– Ali Sheikhpour
Mar 7 at 8:00
at the beginning i have no mediarules, i want to add them by need
– mikeD
Mar 7 at 8:01
at the beginning i have no mediarules, i want to add them by need
– mikeD
Mar 7 at 8:01
@mikeD what is the reason for doing it this way? Its seems to be going about it backwards - media queries let you define the rules so they are automatically applied... You're not just adding extra processing, but you're doing it on the client side which will slow down the page.
– FluffyKitten
Mar 7 at 8:50
@mikeD what is the reason for doing it this way? Its seems to be going about it backwards - media queries let you define the rules so they are automatically applied... You're not just adding extra processing, but you're doing it on the client side which will slow down the page.
– FluffyKitten
Mar 7 at 8:50
add a comment |
2 Answers
2
active
oldest
votes
You can create classes seperately for each media and add that classes to your element with media-query
.
For example,
.desktop
/* styles */
.mobile
/* styles */
Add one of those classes to the element with media-query
@media(max-width: 960px)
/* add desktop class to your specific element */
@media(max-width: 480px)
/* add mobile class to your specific element */
Of course you can mix it with your event handler such as onClick()
ok, please have a look, i've update my post. How or wich selectors i have to use, to matche the wanted style-set and matched the wanted media-rule?
– mikeD
Mar 7 at 8:14
add a comment |
You should define all mandatory class names in your styles and use addClass
and removeClass
to apply new rules to elements.
Please check this snippet and inspect element after click and before click and check its class name:
$(document).ready(function()
$("a").click(function()
$(this).removeClass("defaultClass").addClass("newClass");
)
)
.defaultClass
font-size:20px;
.newclass
font-size:20px;
@media screen and (min-width:920px)
.newclassfont-size:12px;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="defaultClass">Change Font size by clicking Here</a>
Edit: If you dont want to predefine all classes then you can use insertRule
to create new css rules on the fly and then use the method I described. Please check this Q/A for more details.
good idear, but it's not possible to add hundreds possible classes for a website, if at the end only some of then really in use
– mikeD
Mar 7 at 8:29
Please check the edit I have added at the end of answer. @mikeD
– Ali Sheikhpour
Mar 7 at 8:48
yes, that is what i need (but only if i can insert a new class, not only rule), but my question is wich selector i have to use to insert a new rule in the wanted style-set and in the wanted-media-rule
– mikeD
Mar 7 at 8:52
Please refere to this tutorial about modifying css rules davidwalsh.name/add-rules-stylesheets @mikeD
– Ali Sheikhpour
Mar 7 at 9:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038681%2fhow-to-add-media-rules-dynamically-to-a-element%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can create classes seperately for each media and add that classes to your element with media-query
.
For example,
.desktop
/* styles */
.mobile
/* styles */
Add one of those classes to the element with media-query
@media(max-width: 960px)
/* add desktop class to your specific element */
@media(max-width: 480px)
/* add mobile class to your specific element */
Of course you can mix it with your event handler such as onClick()
ok, please have a look, i've update my post. How or wich selectors i have to use, to matche the wanted style-set and matched the wanted media-rule?
– mikeD
Mar 7 at 8:14
add a comment |
You can create classes seperately for each media and add that classes to your element with media-query
.
For example,
.desktop
/* styles */
.mobile
/* styles */
Add one of those classes to the element with media-query
@media(max-width: 960px)
/* add desktop class to your specific element */
@media(max-width: 480px)
/* add mobile class to your specific element */
Of course you can mix it with your event handler such as onClick()
ok, please have a look, i've update my post. How or wich selectors i have to use, to matche the wanted style-set and matched the wanted media-rule?
– mikeD
Mar 7 at 8:14
add a comment |
You can create classes seperately for each media and add that classes to your element with media-query
.
For example,
.desktop
/* styles */
.mobile
/* styles */
Add one of those classes to the element with media-query
@media(max-width: 960px)
/* add desktop class to your specific element */
@media(max-width: 480px)
/* add mobile class to your specific element */
Of course you can mix it with your event handler such as onClick()
You can create classes seperately for each media and add that classes to your element with media-query
.
For example,
.desktop
/* styles */
.mobile
/* styles */
Add one of those classes to the element with media-query
@media(max-width: 960px)
/* add desktop class to your specific element */
@media(max-width: 480px)
/* add mobile class to your specific element */
Of course you can mix it with your event handler such as onClick()
answered Mar 7 at 8:03
kookoo
29213
29213
ok, please have a look, i've update my post. How or wich selectors i have to use, to matche the wanted style-set and matched the wanted media-rule?
– mikeD
Mar 7 at 8:14
add a comment |
ok, please have a look, i've update my post. How or wich selectors i have to use, to matche the wanted style-set and matched the wanted media-rule?
– mikeD
Mar 7 at 8:14
ok, please have a look, i've update my post. How or wich selectors i have to use, to matche the wanted style-set and matched the wanted media-rule?
– mikeD
Mar 7 at 8:14
ok, please have a look, i've update my post. How or wich selectors i have to use, to matche the wanted style-set and matched the wanted media-rule?
– mikeD
Mar 7 at 8:14
add a comment |
You should define all mandatory class names in your styles and use addClass
and removeClass
to apply new rules to elements.
Please check this snippet and inspect element after click and before click and check its class name:
$(document).ready(function()
$("a").click(function()
$(this).removeClass("defaultClass").addClass("newClass");
)
)
.defaultClass
font-size:20px;
.newclass
font-size:20px;
@media screen and (min-width:920px)
.newclassfont-size:12px;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="defaultClass">Change Font size by clicking Here</a>
Edit: If you dont want to predefine all classes then you can use insertRule
to create new css rules on the fly and then use the method I described. Please check this Q/A for more details.
good idear, but it's not possible to add hundreds possible classes for a website, if at the end only some of then really in use
– mikeD
Mar 7 at 8:29
Please check the edit I have added at the end of answer. @mikeD
– Ali Sheikhpour
Mar 7 at 8:48
yes, that is what i need (but only if i can insert a new class, not only rule), but my question is wich selector i have to use to insert a new rule in the wanted style-set and in the wanted-media-rule
– mikeD
Mar 7 at 8:52
Please refere to this tutorial about modifying css rules davidwalsh.name/add-rules-stylesheets @mikeD
– Ali Sheikhpour
Mar 7 at 9:50
add a comment |
You should define all mandatory class names in your styles and use addClass
and removeClass
to apply new rules to elements.
Please check this snippet and inspect element after click and before click and check its class name:
$(document).ready(function()
$("a").click(function()
$(this).removeClass("defaultClass").addClass("newClass");
)
)
.defaultClass
font-size:20px;
.newclass
font-size:20px;
@media screen and (min-width:920px)
.newclassfont-size:12px;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="defaultClass">Change Font size by clicking Here</a>
Edit: If you dont want to predefine all classes then you can use insertRule
to create new css rules on the fly and then use the method I described. Please check this Q/A for more details.
good idear, but it's not possible to add hundreds possible classes for a website, if at the end only some of then really in use
– mikeD
Mar 7 at 8:29
Please check the edit I have added at the end of answer. @mikeD
– Ali Sheikhpour
Mar 7 at 8:48
yes, that is what i need (but only if i can insert a new class, not only rule), but my question is wich selector i have to use to insert a new rule in the wanted style-set and in the wanted-media-rule
– mikeD
Mar 7 at 8:52
Please refere to this tutorial about modifying css rules davidwalsh.name/add-rules-stylesheets @mikeD
– Ali Sheikhpour
Mar 7 at 9:50
add a comment |
You should define all mandatory class names in your styles and use addClass
and removeClass
to apply new rules to elements.
Please check this snippet and inspect element after click and before click and check its class name:
$(document).ready(function()
$("a").click(function()
$(this).removeClass("defaultClass").addClass("newClass");
)
)
.defaultClass
font-size:20px;
.newclass
font-size:20px;
@media screen and (min-width:920px)
.newclassfont-size:12px;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="defaultClass">Change Font size by clicking Here</a>
Edit: If you dont want to predefine all classes then you can use insertRule
to create new css rules on the fly and then use the method I described. Please check this Q/A for more details.
You should define all mandatory class names in your styles and use addClass
and removeClass
to apply new rules to elements.
Please check this snippet and inspect element after click and before click and check its class name:
$(document).ready(function()
$("a").click(function()
$(this).removeClass("defaultClass").addClass("newClass");
)
)
.defaultClass
font-size:20px;
.newclass
font-size:20px;
@media screen and (min-width:920px)
.newclassfont-size:12px;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="defaultClass">Change Font size by clicking Here</a>
Edit: If you dont want to predefine all classes then you can use insertRule
to create new css rules on the fly and then use the method I described. Please check this Q/A for more details.
$(document).ready(function()
$("a").click(function()
$(this).removeClass("defaultClass").addClass("newClass");
)
)
.defaultClass
font-size:20px;
.newclass
font-size:20px;
@media screen and (min-width:920px)
.newclassfont-size:12px;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="defaultClass">Change Font size by clicking Here</a>
$(document).ready(function()
$("a").click(function()
$(this).removeClass("defaultClass").addClass("newClass");
)
)
.defaultClass
font-size:20px;
.newclass
font-size:20px;
@media screen and (min-width:920px)
.newclassfont-size:12px;
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a class="defaultClass">Change Font size by clicking Here</a>
edited Mar 7 at 8:48
answered Mar 7 at 8:27
Ali SheikhpourAli Sheikhpour
5,64111743
5,64111743
good idear, but it's not possible to add hundreds possible classes for a website, if at the end only some of then really in use
– mikeD
Mar 7 at 8:29
Please check the edit I have added at the end of answer. @mikeD
– Ali Sheikhpour
Mar 7 at 8:48
yes, that is what i need (but only if i can insert a new class, not only rule), but my question is wich selector i have to use to insert a new rule in the wanted style-set and in the wanted-media-rule
– mikeD
Mar 7 at 8:52
Please refere to this tutorial about modifying css rules davidwalsh.name/add-rules-stylesheets @mikeD
– Ali Sheikhpour
Mar 7 at 9:50
add a comment |
good idear, but it's not possible to add hundreds possible classes for a website, if at the end only some of then really in use
– mikeD
Mar 7 at 8:29
Please check the edit I have added at the end of answer. @mikeD
– Ali Sheikhpour
Mar 7 at 8:48
yes, that is what i need (but only if i can insert a new class, not only rule), but my question is wich selector i have to use to insert a new rule in the wanted style-set and in the wanted-media-rule
– mikeD
Mar 7 at 8:52
Please refere to this tutorial about modifying css rules davidwalsh.name/add-rules-stylesheets @mikeD
– Ali Sheikhpour
Mar 7 at 9:50
good idear, but it's not possible to add hundreds possible classes for a website, if at the end only some of then really in use
– mikeD
Mar 7 at 8:29
good idear, but it's not possible to add hundreds possible classes for a website, if at the end only some of then really in use
– mikeD
Mar 7 at 8:29
Please check the edit I have added at the end of answer. @mikeD
– Ali Sheikhpour
Mar 7 at 8:48
Please check the edit I have added at the end of answer. @mikeD
– Ali Sheikhpour
Mar 7 at 8:48
yes, that is what i need (but only if i can insert a new class, not only rule), but my question is wich selector i have to use to insert a new rule in the wanted style-set and in the wanted-media-rule
– mikeD
Mar 7 at 8:52
yes, that is what i need (but only if i can insert a new class, not only rule), but my question is wich selector i have to use to insert a new rule in the wanted style-set and in the wanted-media-rule
– mikeD
Mar 7 at 8:52
Please refere to this tutorial about modifying css rules davidwalsh.name/add-rules-stylesheets @mikeD
– Ali Sheikhpour
Mar 7 at 9:50
Please refere to this tutorial about modifying css rules davidwalsh.name/add-rules-stylesheets @mikeD
– Ali Sheikhpour
Mar 7 at 9:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55038681%2fhow-to-add-media-rules-dynamically-to-a-element%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Why forcing media rules without changing media? You can toggle class name of element using jquery
addClass
andremoveClass
– Ali Sheikhpour
Mar 7 at 8:00
at the beginning i have no mediarules, i want to add them by need
– mikeD
Mar 7 at 8:01
@mikeD what is the reason for doing it this way? Its seems to be going about it backwards - media queries let you define the rules so they are automatically applied... You're not just adding extra processing, but you're doing it on the client side which will slow down the page.
– FluffyKitten
Mar 7 at 8:50