view:
def json(request,id):
g = ProductImage.objects.get(pk=id)
large = g.image.url
picture = make_thumbnail(g.image.url, maxwidth=400, maxheight=300,
root=settings.MEDIA_ROOT, url_root=settings.MEDIA_URL)
return JsonResponse({'picture': picture, 'large': large, })
template
head
<script type="text/javascript"
src="/media/js/jquery.jcarousel.pack.js"></script>
<link rel="stylesheet" type="text/css"
href="/media/css/jquery.jcarousel.css" />
<link rel="stylesheet" type="text/css"
href="/media/css/skins/tango/skin.css" />
<script type="text/javascript">
runOnLoad(function() {
var nextimage = function() {
image = $(this).attr('href');
$.get(image, function(stuff){
var json = eval('('+stuff+')');
picture = '<img src=\"'+json.picture+'\"
id=\"displayed-image\" />';
$("#mainbox").html(picture);
return false;
});
return false;
};
$("div#wrap a").click(nextimage);
});
</script>
body
<script type="text/javascript" src="/media/js/wz_tooltip.js"></script>
<div style="padding-top:10px;
padding-bottom:10px;text-align:center; height:320px;" id="mainbox">
{% if startimage %}<a onmouseout="UnTip()"
onmouseover="Tip('<img src=\'{{ startimage.url }}\'>',LEFT, true, OFFSETY,
-250, OFFSETX, 0, WIDTH, 800 )" target="_blank"><img
src="{{startimage.url|thumbnail:"maxwidth=400, maxheight=300"}}"
id="mainimage" alt=""/></a>{% endif %}
</div>
<div> </div>
<div id="wrap">
<ul id="mycarousel" class="jcarousel-skin-tango">
{% for i in this.productimage_set.all %}
<li><a href="/machinery/json/{{i.id}}/"><img
style="border:none;" {% if i.image %}src='{{
i.image.url|thumbnail:"maxwidth=120, maxheight=80" }}'{% else
%}"/media/images/base/missing.jpg"{% endif %} alt='{{i.caption}}'
/></a></li>
{% endfor %}
</ul>
</div>
The question is how to incorporate the onmouseout onmouseover into picture
= '<img src=\"'+json.picture+'\" id=\"displayed-image\" />'; so it returns
a complete string calling json.large in the Tip? Everything I have tried
just kills the json return.
This is the nearest I think I have got:
picture = '<a onmouseout=\"UnTip()\"
onmouseover=\"Tip(\"'+json.large+'\")'>',Left, true, OFFSETY, -250,
OFFSETX, 0, WIDTH, 800)\" target=\"_blank\"><img src=\"'+json.picture+'\"
id=\"displayed-image\" /></a>';
beginning to wonder if the problem may be that wz-tooltip is called after
the body tag that this will never work so any solutiosn gratefully
received,
the theory is change the main image using json and be able to tooltip the
image with an unthumbnailed original
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.