Forum Replies Created
-
AuthorPosts
-
neilmacMember
Hi Jackie
I think I've just solved it - prodded on by you!
I think I should have used wp_is_mobile instead of is_mobile.
Or at least that seems to be working for me now.
I've been scratching my head about this for ages
The odd thing is the other way - is_mobile - is still working ok on the local site.
Anyway, I'll go with what works live. Unless anyone can see a problem with that?
Thanks very much
N.September 27, 2014 at 3:17 pm in reply to: Conditional Code to Run Depending on Display Resolution #126006neilmacMemberThanks Brad.
Thing out loud, maybe I don't need to add a body class if I use wp_is_mobile.
If I used something like if ( !wp_is_mobile() ) perhaps I could add some code to a hook which would only work on desktop displays - or at least larger than tablet. Which is the behaviour I want.
Would that work? Or is it a bad idea for any reason?
ThanksneilmacMemberHi Michael
No, I would still like to do this.
Thanks
neilmacMemberWell yes, I'd like to see that Brad, thanks.
I could always create a new template and add that in.neilmacMemberThanks Brad
I can see plenty of advice on adding jquery but is this not regular vanilla javascript?
What should I do there?
If I just try to add...<script type="text/javascript" language="Javascript" src="">
function explodeWidth() {
var browserWidth = $(document).width();
var wrapWidth = $('.site-inner .wrap').width();
var margin = ( ( browserWidth - wrapWidth ) / 2 );
$('.landing').css( 'margin-left', - margin ).css( 'margin-right', - margin );
}
explodeWidth();
$(window).resize(explodeWidth);
</script>...it fails.
Many thanks
-
AuthorPosts