Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ Style with ``#fullsized_fullscreen``

**loop** (optional, defaults to false) - don't hide prev/next button on first/last image, so images are looped

**caption** (optional, defaults to false) - display a caption above the image. Caption dan be set using ``data-caption`` on the fullsizable and will fall back to the ``title`` of the thumbnail.
Styled with ``#fullsized_caption``


## Styling
The packaged ``fullsizable.css`` stylesheet provides only the bare bones to make fullsizable work. Everything
Expand Down
4 changes: 4 additions & 0 deletions css/jquery-fullsizable.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
display: block;
margin: 0 auto;
}
#fullsized_caption{
color: #ffffff;
text-align: center;
}
80 changes: 80 additions & 0 deletions examples/simple_with_caption.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery.fullsizable example/demo</title>
<meta name="description" content="jQuery fullsizable Example" />
<meta name="author" content="Matthias Schmidt - http://m-schmidt.eu" />
<style type="text/css" media="screen">
#container {
min-height: 1000px;
}
</style>
<link rel="stylesheet" href="../css/jquery-fullsizable.css" />
<style type="text/css" media="screen">
#fullsized_go_prev, #fullsized_go_next, #fullsized_close, #fullsized_fullscreen {
position: absolute;
top: 50%;
display: block;
width: 30px;
height: 30px;
background-color: red;
}
#fullsized_go_prev {
left: 25px;
}
#fullsized_go_next {
right: 25px;
}
#fullsized_close {
top: 0;
right: 0;
}
#fullsized_fullscreen {
top: 0;
right: 40px;
background-color: green;
}
:fullscreen #fullsized_fullscreen { background-color: blue; }
:-webkit-full-screen #fullsized_fullscreen { background-color: blue; }
:-moz-full-screen #fullsized_fullscreen { background-color: blue; }
</style>
<script src="../js/jquery-1.7.2.js"></script>
<script src="../js/jquery-fullsizable.js"></script>
<script>
$(function() {
$('a').fullsizable({
detach_id: 'container',
clickBehaviour: 'next',
caption : true
});
});
</script>
</head>

<body>
<h1>jQuery.fullsizable</h1>
<div id="container">
<a data-caption="Locomotives Roundhouse" href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/1000px-Locomotives-Roundhouse2.jpg">
<img title="Locomotives Roundhouse"
alt="Steam locomotives of the Chicago &amp; North Western Railway."
src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/34/Locomotives-Roundhouse2.jpg/100px-Locomotives-Roundhouse2.jpg">
</a>
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Icebergs_in_the_High_Arctic_-_20050907.jpg/1000px-Icebergs_in_the_High_Arctic_-_20050907.jpg">
<img title="Icebergs in the High Arctic"
alt="”The debris loading isn't particularly extensive, but the color is usual.”"
src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/36/Icebergs_in_the_High_Arctic_-_20050907.jpg/100px-Icebergs_in_the_High_Arctic_-_20050907.jpg">
</a>
<a href="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/1000px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg">
<img
alt="Xysticus cristatus, A Estrada, Galicia, Spain"
src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg/100px-Ara%C3%B1a._A_Estrada%2C_Galiza._02.jpg">
</a>
<a data-caption="Araña" href="http://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Fitness_Model_Britt_2007.JPG/1000px-Fitness_Model_Britt_2007.JPG">
<img title="Araña"
alt="Xysticus cristatus, A Estrada, Galicia, Spain"
src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/Fitness_Model_Britt_2007.JPG/100px-Fitness_Model_Britt_2007.JPG">
</a>
</div>
</body>
</html>
13 changes: 11 additions & 2 deletions js/jquery-fullsizable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Options:
**preload** (optional, defaults to true) - lookup selector on initialization, set only to false in combination with ``reloadOnOpen: true`` or ``fullsizable:reload`` event.
**reloadOnOpen** (optional, defaults to false) - lookup selector every time the viewer opens.
**loop** (optional, defaults to false) - don't hide prev/next button on first/last image, so images are looped
**caption** (optional, defaults to false) - display a caption above the image. Caption dan be set using ``data-caption`` on the fullsizable and will fall back to the ``title`` of the thumbnail.
###

$ = jQuery
Expand All @@ -25,6 +26,7 @@ container_id = '#jquery-fullsizable'
image_holder_id = '#fullsized_image_holder'
spinner_class = 'fullsized_spinner'
$image_holder = $('<div id="jquery-fullsizable"><div id="fullsized_image_holder"></div></div>')
$caption_holder = $('<div id="fullsized_caption"></div>')

images = []
current_image = 0
Expand Down Expand Up @@ -69,6 +71,7 @@ showImage = (image, direction = 1, shouldHideChrome = false) ->
current_image = image.index
$(image_holder_id).hide()
$(image_holder_id).html(image)
$caption_holder.text(image.caption) if image.caption && options.caption

# show/hide navigation when hitting range limits
if options.navigation
Expand Down Expand Up @@ -136,12 +139,14 @@ makeFullsizable = ->

$(options.selector).each ->
image = new Image
image.buffer_src = $(this).attr('href')
$this = $(this)
image.buffer_src = $this.attr('href')
image.index = images.length
image.caption = $this.data('caption') || $this.children('img:first').attr('title') if options.caption
images.push image

if options.openOnClick
$(this).click (e) ->
$this.click (e) ->
e.preventDefault()
makeFullsizable() if options.reloadOnOpen
openViewer(image, this)
Expand Down Expand Up @@ -172,6 +177,9 @@ prepareCurtain = ->
e.stopPropagation()
toggleFullscreen()

if options.caption
$image_holder.prepend($caption_holder )

switch options.clickBehaviour
when 'close' then $(document).on 'click', container_id, closeViewer
when 'next' then $(document).on 'click', container_id, -> nextImage(true)
Expand Down Expand Up @@ -225,6 +233,7 @@ $.fn.fullsizable = (opts) ->
preload: true
reloadOnOpen: false
loop: false
caption : false
, opts || {}

prepareCurtain()
Expand Down
40 changes: 27 additions & 13 deletions js/jquery-fullsizable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading