Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <img src="img/derp/2.jpg"/>
- //DETECT THE INITIAL SCREEN WIDTH AND CHANGE THE PATH TO LOAD THE APPROPRIATE IMAGES
- if ($(window).width() < 960) {
- $("img").each(function() {
- $(this).attr("src", $(this).attr("src").replace("img/derp", "img/port"));
- });
- }
- else {
- $("img").each(function() {
- $(this).attr("src", $(this).attr("src").replace("img/derp", "img/land"));
- });
- }
- //DETECT THE CHANGED SCREEN WIDTH AND SWITCH THE IMAGE PATH IF NECESSARY
- $(window).on('resize', function() {
- if ($(window).width() < 960) {
- $("img").each(function() {
- $(this).attr("src", $(this).attr("src").replace("img/land", "img/port"));
- });
- } else {
- $("img").each(function() {
- $(this).attr("src", $(this).attr("src").replace("img/port", "img/land"));
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement