简体   繁体   中英

Fire a jQuery event when element gets pushed to new line

How can I fire a jquery event if the element in view gets pushed to a new line? I'd like to hide the nav items and also run some other javascript when this happens. Any suggestions on how to do this?

In a large view this is what my nav looks like:

大视图导航

This is what happens when I reduce my screen width. When this happens I want to fire events on those elements. How do I do this?

宽度更短的导航

If the view get's pushed down, it's based on the width of the container.

Try using .resize() to keep track of the width & call the relevant functions when the width get's lower.

$(window).resize(function() {

  // if the navigation DIV's width is smaller than xyz, do this ...

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM