I'm trying to remove a CSS class when the page is opened from mobile device.
Here's the code:
add_action( 'wp_footer', 'remove_slideup' );
function remove_slideup() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
var alterClass = function() {
var ww = document.body.clientWidth;
if (ww < 1025) {
alert('under 1025!');
$('.thumb-wrapper').removeClass('slideup');
$('.thumb-wrapper').css({'overflow':'hidden', 'position':'relative', 'display':'block', 'margin-bottom':'10px'});
$('.quick-view').hide();
} else if (ww >= 1025) {
alert('over 1024!');
$('.thumb-wrapper').addClass('slideup');
$('.quick-view').show();
};
};
$(window).resize(function(){
alterClass();
});
//Fire it when the page first loads:
alterClass();
});
</script>
<?php
}
Basically it's changing this:
<div class="thumb-wrapper slideup">
to this in mobile devices:
<div class="thumb-wrapper">
The problem is, this code is working fine in Firefox, but not in Chrome.
Any help is appreciated, thanks.