jquery - Remove html if width is less than 767px -


currently, have modal pop-up (shadowbox) "feedback" form our site. fine modal on desktop browsers, want open new "page" on mobile browser (less 767px) , away modal complications on mobile devices.

is there jquery solution remove 'rel="shadowbox"' element link code opens new browser window?

example:

desktop version

<a href="site.com" target="_blank" rel="shadowbox">link</a> 

767px or less version

<a href="site.com" target="_blank">link</a> 

so far have script:

<script> $( "a" )   .contents()   .filter(function(){     return this.nodetype !== 1;   })   .remove( "rel="shadowbox"" ); </script> 

i cannot figure out how first detect width apply "if, then".

help appreciated! i, admittedly, not work js as need to.

http://jsfiddle.net/hcxwe/

if($(window).width() < 768){     console.log('kill shadowbox');     $("a[rel='shadowbox']" ).removeattr('rel'); } 

you may encounter issues listeners attached elements prior shadowbox rel being removed.

see fiddle

http://jsfiddle.net/qv882/


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -