try it like this:
$.each($('.gallery img'), function () {
var rndmnum = Math.floor((Math.random()*11)+1);
rndmnum = rndmnum *20 + 260;
$(this).css({
'max-width' : rndmnum
});
});
note: untested
sources:
https://stackoverflow.com/questions/8904707/javascript-random-number-between-15-and-225-increments-of-30
https://stackoverflow.com/questions/8733838/random-max-width-for-each-image-on-a-page
edit: corrected calculation
Related Posts:
- Check if post/page has gallery?
- how to have the gallery shortcode output one single UL list instead of several DL?
- Automatically add this attribute to the gallery shortcode
- How do i link gallery thumbnails to different url’s using the wp native gallery?
- WordPress gallery ‘post_gallery’ filter doesn’t work with feeds?
- conditional shortcode not working
- Remove width and height attributes from [gallery] output
- Gallery shortcode menu order fix no longer working on WordPress 4.0
- conditional shortcode not working
- Some doubts about gallery shortcode in WordPress
- Should I cache default WordPress gallery shortcode output?
- Numbering Image List in Gallery
- Rewriting WordPress Gallery Shortcode with Bootstrap Carousel
- change wordpress gallery shortcode to slider
- Remove hyperlink on gallery shortcode
- Add custom setting that uses radio button to WP Gallery
- WordPress Gallery shortcode: Display one category ID only
- How to get gallery id inserted to a post?
- Check if post has gallery images/media
- How to Modify WordPress Default Image Gallery Shortcode
- Change WordPress Shortcode added in to post
- Gallery shortcode – change link file image size? (not using default fullsize image)
- add action only if gallery shortcode attribute is equal to?
- Unable to the get the gallery inserted between shortcodes
- Adding shortcode field to edit gallery / Gallery Settings
- How to change the output of gallery shortcode
- Replacement for gallery_shortcode function not taking all attributes
- How to Retrieve data of Gallery Shortcode and display it above a post
- How to copy [gallery] shortcode between posts using polylang [closed]
- Which file renders the “Edit Gallery” Settings page?
- How to display NextGEN gallery in templates?
- Use full size images in a specific gallery
- How to Enable embedding WordPress default gallery in comments?
- How to add new images to existing shortcode configuration?
- Gallery shortcode is empty but magically creates a gallery
- Can we add a single caption to the gallery shortcode?
- Automatically add class-attribute to gallery?
- Replace custom gallery shortcode with default gallery shortcode
- WordPress Gallery with ID’s Shortcode not Working
- Remove width and height attributes from [gallery] output
- What makes a placeholder resizable in Tinymce?
- how to show last 5 images from the one post gallery
- Gallery Shortcode: using size=”full” doesn’t call the actual thumbnail image size
- Custom shortcode being executed when saving page in wp-admin
- Change appearance of shortcode text inside editor
- Shortcode output always showing at top of page
- How to detect if a Shortcode is being called on a page?
- Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]
- shortcode to create dynamic dropdown box form shortcode attributes
- Ajax not returning anything on form submit
- How do I add my own custom shortcodes?
- Can’t seem to get [shortcode]s to work
- nested Shortcode doesn’t work
- Slow page loading when using a simple shortcode on the same page multiple times
- TinyMCE get selected text and underlying HTML
- Remove and restore one shortcode
- Using ACF field in do_shortcode()
- Display content from another site page using a shortcode
- Combining similar shortcode functions?
- Creating a shortcode based on users preferences
- Get a post’s thumbnail url or display default image in shortcode
- Convert HTML Script to Shortcode [closed]
- What is the Correct way to pass parameters in function
- Shortcode – Getting Categories appears on top of website
- Passing html tags as shortcode parameters
- Registration Form Shortcode
- Turn off image captions in gallery view?
- Conditionally Loading JavaScript/CSS for Shortcodes
- Add the last viewed post title to a contactform with shortcode [closed]
- Make a Shortcode load after Post/Page Content?
- Adding JS in header when using wp_enqueue_script in a shortcode
- Just display content between shortcode brackets
- How to explode single string IF it’s used in shortcode
- Check if CTP category taxonomy is set in shortcode
- Getting Page Content Using Shortcode
- Turning variable into a value set in shortcode
- tax query shortcode
- How can I extract a word from page/post URL using shortcodes
- Shortcode question…. javascript
- Variable inside shortcode or shortcode inside shortcode
- Remove figcation from excerpt
- Shortcode select another dbbase
- Hide password protected dynamic content in templates via shortcode
- Geoip shortcodes in comments
- Shortcode not interpreted if parameter set
- Using shortcode to stop post content from displaying
- Shortcode Attribute contains clone of all shortcode attributes
- How to echo an array returned by a function
- Creating custom shortcode
- What is short code for following?
- Automate post creation in wordpress
- Shortcode or placeholder for theme options page?
- How to print [embed] code in wordpress [duplicate]
- add php shortcode in return function
- Display post_meta in Shortcode
- Gallery Shortcode Function Help
- WordPress Shortcode loads at the top
- php code to shortcode [duplicate]
- Custom shortcode with < in content
- add_action to only be called if uploading media from the front end