Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Note unsupported


Warning
titleEngine Compatibility
replace_image_src is not supported by the Node engine.

replace_image_src(<sel>, <url>)

Replace the source of the image tag having ID of <sel> with the given URL. The effect is that the picture changes without flicker on modern browsers if the image tag has height and weight attributes and replacement image has the same size.

Code Block
languagejavascript
themeConfluencelanguagejavascript
replace_image_src("#foo", "http://example.com/image.jpg")

The following ruleset shows replace_image_src() being used

Code Block
languagejavascript
themeConfluencelanguagejavascript
ruleset a1299x183 {
	meta {
		name "Replace Image Src Example"
		
		author "nathan cerny"
		logging off
	}
	dispatch {
		// domain "exampley.com"
	}
    
	rule replace_image {
		select when pageview ".*" setting ()
		replace_image_src('#replace_image', 'http://kynetx-images.s3.amazonaws.com/documentation/Misc/switch_01.jpg');
	}
}

...