I am pretty new and got a following problem...
case:
We got an accordion and within this accordion we got an sexy-combo-box
<html>
<head>
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/lib/jquery.sexy-combo-2.1.2.min.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/examples/usage.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/jquery.autogrow.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/lib/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/development-bundle/ui/ui.core.js"></script>
<script type="text/javascript" src="../../../../Library/WebServer/Documents/sexy-combo/development-bundle/ui/ui.accordion.js"></script>
<link rel="stylesheet" type="text/css" href="../../../../Library/WebServer/Documents/sexy-combo/lib/sexy-combo.css" />
<link rel="stylesheet" type="text/css" href="../../../../Library/WebServer/Documents/sexy-combo/skins/sexy/sexy.css" />
<script type="text/javascript">
$(document).ready(function(){
$("#accordion").accordion();
$("#basic-combo").sexyCombo();
});
</script>
</head>
<body style="font-size:62.5%;">
<div id="accordion">
<h3>Form A</h3>
<div>
<p>Please fill out the following:</p>
<p>1. What cookies do you like?</p>
<p><select id="basic-combo" name="resObj" size="2">
<option>jelly</option>
<option>biscuit</option>
<option>chocolate</option>
</select>
</p>
<p>2. What ice cream do you like?</p>
<p><select id="empty-combo" name="sort" size="2">
<option>strawberry</option>
<option>chocolate</option>
<option>vanilla</option>
</select></p>
<p>3. please tell us, how did you get attention to this site?</p>
<p>
<textarea style="width: 400px; height: 84px; min-height: 80px;" class="expanding" name="myTextarea"></textarea>
</p>
</div>
<h3>Form B</h3>
<div>
<p>4. Please tell us the minimum and max amount of chocolate that you eat:</p>
<p>min
<input name="minConsump" type="text" id="start" size="5" />
max
<input name="maxConsump" type="text" id="finish" size="5" />
required time (in minutes) that you take to eat the amount
<input name="reqTime" type="text" id="time" size="5" />
</p>
</div>
</body>
</html>
problem:
- accordion works fine, but sexy combo does not, you can just see the "normal" selection-box
already tried/strange phenomenon:
- removing $("#accordion").accordion(); causes that sexy combo works
possible reason:
- accordion starts before the sexy combo object ...after all the sexy combo object is not being loaded or some sort of "hidden" by the accordion object
does someone has an idea what the reason for this behavior could be ? or how to fix it ?
After reading some topics here I found smth. out like a jQuery live plugin, and that maybe I do need this plugin in order to handle it that when accordion is loaded, the sexy-combo plugin loads too.
best regards
leejin
I found a similar problem when using the sexyCombo in a dialog, so it would be worth checking whether the same problem exists when using it with an accordion.
After examining the markup I realised that the height of the list was being set to 0 when the combo was rendered in the dialog.
I added a dirty hack to my local copy of sexyCombo. Check out line 194 (ish) of the Javascript:
this.singleItemHeight = this.listItems.outerHeight();
For some reason outerHeight() returns 0, so I just added a check to see if singleItemHeight was 0 and if so set it to a sensible value.
Related
I can find several tutorials on how to render stl files to something that looks like thingiverse renderings but I can't seem to get anything to work on a windows machine. Anyone know how I can do this?
Well someone obviously doesn't like the question but I am sure others have had the problem so here is how I solved it.
I created a web page that rendered the image using jsc3d
<html>
<header>
<link rel="stylesheet" href="/web_inc/all.css">
<script type="text/JavaScript" src="/web_inc/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="/web_inc/jquery.form.min.js"></script>
<link rel="stylesheet" href="/web_inc/bootstrap.min.css">
<link rel="stylesheet" href="/web_inc/bootstrap-theme.min.css">
<script type="text/javascript" src="/web_inc/bootstrap.min.js"></script>
<script type="text/javascript" src="/web_inc/jsc3d.js"></script>
<script type="text/javascript" src="/web_inc/jsc3d.console.js"></script>
<script type="text/javascript" src="/web_inc/jsc3d.webgl.js"></script>
<script type="text/javascript" src="/web_inc/jsc3d.touch.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var canvas = document.getElementById('cv');
canvas.width=1200;
canvas.height=900;
var viewer = new JSC3D.Viewer(canvas);
viewer.setParameter('SceneUrl', '/model/1.stl');
viewer.setParameter('InitRotationX', 0);
viewer.setParameter('InitRotationY', 30);
viewer.setParameter('InitRotationZ', 0);
viewer.setParameter('ModelColor', '#57524C');
viewer.setParameter('BackgroundColor1', '#FFFFFF');
viewer.setParameter('BackgroundColor2', '#999999');
viewer.setParameter('RenderMode', 'flat');
viewer.setParameter('MipMapping', 'on');
viewer.setParameter('Renderer', 'webgl');
viewer.setParameter('Definition', 'high');
viewer.init();
viewer.update();
});
function savePreview() {
var canvas = document.getElementById("cv");
$("#imageData").val(canvas.toDataURL("image/png"));
$("#uploadForm").ajaxSubmit({url: '/ajax_update_sim.php', type: 'post'});
}
</script>
</header>
<body>
<canvas id="cv" class="viewerCanvas"></canvas>
<form action="/ajax_upload_sim.php" method="post" enctype="multipart/form-data" id="uploadForm">
<input type="hidden" name="id" value="1">
<input type="hidden" name="data" id="imageData">
</form>
<input type="button" class="button" value="Save Preview" onclick="savePreview();"/>
</body>
</html>
I then created a php file to save the results
$src="img/1.png"
file_put_contents($src, base64_decode(explode(",", $_REQUEST['data'])[1]));
It seems select2.js 3.4.6 is broken in Firefox. First here is my setup:
VS2013 with a brand new empty asp.net website
Nuget select2 version 3.4.6 and put content\css in root of folder.
jquery 1.7.2.min.js (this I can't change)
I tried it with the latest version of jquery as well 2.1.3.min.js but it still not does not work.
Here is the guts of my default.aspx:
.....
<head runat="server">
<link href="select2.css" rel="stylesheet" />
<script src="scripts/jquery-1.7.2.min.js"></script>
<%--<script src="Scripts/jquery-2.1.3.min.js"></script>--%>
<script src="Scripts/select2.js"></script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList ID="testddl" runat="server">
<asp:ListItem Text="SELECT 0" Value="0"></asp:ListItem>
<asp:ListItem Text="SELECT 1" Value="1"></asp:ListItem>
<asp:ListItem Text="SELECT 2" Value="2"></asp:ListItem>
<asp:ListItem Text="SELECT 3" Value="3"></asp:ListItem>
</asp:DropDownList>
</form>
<script type="text/javascript">
$(document).ready(function () {
$('#<%= testddl.ClientID %>').select2();
});
</script>
</body>
In IE and Chrome, you get what you expect when you click on the dropdown list you get the choice to either search or click an option.
In FireFox with jquery 1.7.2 nothing happens at all with no errors or anything.
With jquery 2.1.3 the click event registers and the search appears. In firebug console you get the error:
elem.dispatchEvent is not a function
Anyone else replicate this or shed some light on select2 and Firefox?
Kevin: here is the viewsource with jquery 1.7.2
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link href="select2.css" rel="stylesheet" />
<script src="jquery-1.7.2.min.js"></script>
<script src="Scripts/select2.js"></script>
<title>
</title></head>
<body>
<form method="post" action="Default.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="rzorPxUMAwO3Ap172UChrRo4HUD4DtvNTx+VojgNlTE4Z1WmG3D212ozs0UVxLT8Q50uK2YscIaU24HMNCX6c5MQGDfn61HSvool3WGTuKU=" />
</div>
<select name="testddl" id="testddl">
<option value="0">SELECT 0</option>
<option value="1">SELECT 1</option>
<option value="2">SELECT 2</option>
<option value="3">SELECT 3</option>
</select>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="CA0B0334" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="t9N12Ik6h7qTjLhTZkuIejUWEi90srmhi63V8Xxh5pkkbjq561Ko2F9PQuAmdKwKaoeu6f472sorebw82ieEjsj2IhbFITiMDWEoVejMoYSzIHNQlnDslXkhYImzMFQthR/syFIMC/KRkWmmML5c1zyVI+iICo/RNEMphVUXC8H2k7ppUV9WGf1v/Qtt4r5f" />
</div></form>
<script type="text/javascript">
$(document).ready(function () {
$('#testddl').select2();
});
</script>
<!-- Visual Studio Browser Link -->
<script type="application/json" id="__browserLink_initializationData">
{"appName":"Firefox","requestId":"b325ea7bc00946f380770a778efc9ccb"}
</script>
<script type="text/javascript" src="http://localhost:16589/250bbcfce1e348a18cc7ff513cc14ddf/browserLink" async="async"></script>
<!-- End Browser Link -->
</body>
</html>
UPDATE
This apparently is not a jquery or select2 issue. When I closed my firefox browser and re-opened it from scratch everything worked, BUT, when I hit F12 to open firebug the select2 dropdown stopped working! Even closing firebug does not re-enable the dropdown. I have to close all my FF browser sessions to get it working again.
UPDATE 2
This is directly related to the issue when FireQuery not Firebug is enabled noted here:
https://github.com/select2/select2/issues/2614
I am trying to add a zoom on my image with the jQuery (brilliant) plugin gzoom (http://lab.gianiaz.com/jquery/gzoom/ or http://www.chouselive.co.za/demo/pictures/zoom/gzoom.php).
But it doesn't work. My image is just resized, but there is no zoom in it.
Here is my code :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test gzoom</title>
<link rel="stylesheet" href="css/jquery-ui-1.7.1.custom.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/jquery.gzoom.css" type="text/css" media="screen">
<style>
div#zoom{
cursor: crosshair;
}
</style>
</head>
<body>
<div id="gzoomwrap">
<div id="zoom" class="zoom minizoompan">
<span class="loader">loading...</span>
<img src='img/myImage.png'/>
</div>
<!-- START gzoom zoom bar -->
<div class="ui-icon ui-icon-circle-minus gzoombutton"> </div>
<div class="gzoomSlider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all" style="width: 258px;"></div>
<div class="ui-icon ui-icon-circle-plus gzoombutton"> </div>
<br style="clear:both">
<!-- END gzoom zoom bar -->
</div>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<!-- START gzoom dependencies -->
<script type="text/javascript" src="js/ui.core.min.js"></script>
<script type="text/javascript" src="js/ui.slider.min.js"></script>
<script type="text/javascript" src="js/jquery.gzoom.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
$(function() {
$zoom = $("#zoom").gzoom({
sW: 300,
sH: 225,
lW: 1400,
lH: 1050,
lighbox : false
});
});
/*]]>*/
</script>
<!-- END gzoom dependencies -->
</body>
</html>
I looked on the Chrome console, and found some errors in the libraries. So I assume I didn't implement gzoom correctly. (Doesn't work in all browsers)
If you know what I'm doing wrong... I'll thank you a lot !
I'm the gzoom plugin author.
The plugin was developed a lot of time ago, but it's still working with new versions of jquery and jquery ui.
If you include a modern jquery version you have also to include a modern version of jquery-ui.
I've just tried the plugin with this versions and it does his job:
jquery-1.10.2.min.js
jquery-ui-1.10.3.custom.min.js
Include this files, and remove the ui.core.min from, and ui.slider.min.
I tried a simple datepicker in my codeigniter page but somehow it's not showing datepicker.
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://jqueryui.com/resources/demos/style.css" />
<script type="text/javascript">
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
my html code is,
<input type="text" placeholder="Pickup Date" id="datepicker" name="datepicker" class="formfield_text hasDatepicker">
Try this as your html code,
<input type="text" placeholder="Pickup Date" id="datepicker" name="datepicker" class="formfield_text">
This works. The problem is that you can not use class hasDatepicker. Remove it and try.
I need fadeout a div in my page using prototype. How can I fadeout following jquery code in prototype?
$('.exercise-main .content .loading-failure').fadeOut(function(){
//my code
}
I think you will need to use script.aculo.us (which is an excellent add-on to the fantastic prototype.js) so as to achieve the Fade effect.
Basic Syntax
new Effect.Fade('id_of_element', [options]);
OR
new Effect.Fade(element, [options]);
Complete Code.
<html>
<head>
<title>script.aculo.us examples</title>
<script type="text/javascript"
src="/javascript/prototype.js"></script>
<script type="text/javascript"
src="/javascript/scriptaculous.js?load=effects"></script>
<script type="text/javascript">
function FadeEffect(element){
new Effect.Fade(element,
{ duration:1});
}
function ShowEffect(element){
new Effect.Appear(element,
{duration:1, from:1.0, to:1.0});
}
</script>
</head>
<body>
<div onclick="FadeEffect('hideshow')">
Click me to fade out the image
</div>
<br />
<div onclick="ShowEffect('hideshow')">
Click me to display the image once again
</div>
<br />
<div id="hideshow">
<img src="/images/scriptaculous.gif" alt="script.aculo.us" />
</div>
</body>
</html>
Tutorial link - http://www.tutorialspoint.com/script.aculo.us/scriptaculous_fade_effect.htm
I myself have used prototype.js and this add-on very heavily so just in case you face any issue, feel free to comment.. :-)