Reputation: 98
This has just been driving me bonkers. I've looked this up in several places and can't get it to work. All I want to do is add a "fancybox-iframe" class in a menu item (the last one, "contact us") as shown here, and so far, I can't get any code to work. I cannot do this in CSS, either. Can someone please help!!!??
Upvotes: 0
Views: 720
Reputation: 98
I got it! Was missing a bit of love - I was being to literal, thanks Josh!
<script>
jQuery(document).ready(function($) {
if (window.innerWidth > 768) {
document.getElementById('menu-item-34').className +='fancybox-iframe';
}
});
</script>
Upvotes: 0
Reputation: 332
Could you do something like this?
if (window.innerWidth > 768) {
document.getElementById('menu-item-34').className += ' fancybox-iframe';
}
(where menu-item-34
is the id of the contact us button)
Upvotes: 2