View Single Post
Old 11-08-2012, 06:31 PM   PM User | #3
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,306
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
I would do it this way, but you may have other concerns

Code:
<script type="text/javascript">
function expander() {
// Variable to detect window width.
var windowWidth = jQuery(window).width();

 if (windowWidth>768) {
  jQuery(".MenuContent").hide();
  jQuery(".Menuheading").click(function()  {
    jQuery(this).next(".MenuContent").slideToggle(500);
  });
}
};
// Wait for the page to load
jQuery(document).ready(function ($) {
        // Load expander.
expander();
$(window).resize(function(){
expander();
});
});
</script>
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Users who have thanked DanInMa for this post:
LaurelRose (11-08-2012)