This is the little function I made so far:
Expand|Select|Wrap|Line Numbers
- $(window).load(function() {
- // Check media queries
- if($(window).width() >= 769) {
- // Get pathname of page
- var page = window.location.pathname;
- // If pathname matches any of these
- if(page = 'Page2','Page3','Page4'){
- // Remove two elements
- $('#element1').css('display','none');
- $('#element2').css('display','none');
- }
- else{
- $('#element1').css('display','block');
- $('#element2').css('display','block');
- }
- }
- });
It's the second and third lines that are the problem - the elements are removed from all pages of the app, not just the three pages that are set up.
Also, not sure if the else statement is needed. Please let me know if it's redundant.