I have this strange problem. When I put an input with datepicker class into a fyncybox wrap, datepicker does not show up when I click on that input.
Open
<div id="test" style="display:none;width:300px;">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque blandit, mi sed
</p>
<input type="text" class="datepicker"/>
</div>
$(".datepicker").datepicker();
$(".fancybox").fancybox({
openEffect : 'none',
closeEffect : 'none',
afterLoad : function() {
this.inner.prepend( '<h1>1. My custom title</h1>' );
this.content = '<h1>2. My custom title</h1>' + this.content.html();
}
});
See this example on fiddle.
Thanks in advance ;-)
Hi I have eventually found these two solutions:
FIRST:
fiddle of first solution here
$(document).on('click', '.datepicker', function(){
if (!$(this).hasClass('hasDatepicker')) {
$(this).datepicker(); $(this).datepicker('show');
}
});
$(".fancybox").fancybox({
openEffect : 'none',
closeEffect : 'none',
afterLoad : function() {
this.inner.prepend( '<h1>1. My custom title</h1>' );
this.content = '<h1>2. My custom title</h1>'+ this.content.html();
}
});
SECOND:
fiddle of second solution here
$(".datepicker").datepicker();
$(".fancybox").fancybox({
openEffect : 'none',
closeEffect : 'none'
});
This line is confusing jquery ui, because your are copying the html.
this.content = '<h1>2. My custom title</h1>' + this.content.html();
You can see this happening when removing the display: none. Try add html to the original div, this will work fine:
$(".fancybox").fancybox({
openEffect : 'none',
closeEffect : 'none',
afterLoad : function() {
$("#test").prepend( '<h1>1. My custom title</h1>' );
$("#test").prepend('<h1>2. My custom title</h1>');
}
});
Related
I'm trying to add an additional class to my jQuery dialog with the dialogClass property. Here's the javascript:
$(function(){
$( "#toogleMAmaximized" ).dialog({
title: 'Missions and Achivments',
autoOpen: false,
height: 500,
width: 700,
modal: true,
dialogClass: 'noPadding',
buttons: {
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
})
$( "#toogleMAminimized" ).click(function() {
$( "#toogleMAmaximized" ).dialog( "open" );
$( "#toogleMAmaximized" ).dialog({dialogClass:'noPadding'});
});
})
<div id="toogleMAminimized" style="" class="noPadding">
<div class="" style="cursor: pointer;position: absolute;right: 0;top: 45px;"><img src ="images/MAminimized.png" alt="missions and achivments"/></div>
</div>
Just in case you need it, my html code
<div id="toogleMAmaximized" >
<div id="missions">
<div id="mission1" missiontitle="A new home!" missionpoint="1" missionicon="images/missions/icon/anewhome-icon.png" missionimage="images/missions/anewhome.png" made="f" class="mission notDone"> </div>
</div>
<div id="achivments">
<div id="achivment1" achivmenttitle="Lucha sin cuartel!" achivmentpoint="10" achivmenticon="images/achivments/icon/1.png" achivmentimage="images/achivments/icon/luchasincuartel-plata-ico.png" made="t" class="achivment done"> </div>
</div>
</div>
As you can see, I've tried to add the class in many ways, I've tried all possible combinations but keep getting the same result: no noPadding class
Your noPadding class is being added successfully to the dialog. I have confirmed this by placing your markup and scripts within a fiddle, and loading jQuery UI 1.8.16 (the version you were testing with). This test is available online at http://jsfiddle.net/QHJKm/3/.
I suspect the confusion here is with the expected effect noPadding is going to have on the dialog itself. It could be that you interpreted its lack of effect as an indication it wasn't added to begin with. As you'll note in my example, I've got with a rather bold style, a red background. This quickly confirms that the class is indeed being added to the dialog.
I want a ProgressBar for Password strength, so Is there a way to write text inside progressbar. I have try many way but nothing find, can any one help me to do this with event handler to control. My code is....
$( "#progressbar" ).progressbar({
value: score
});
outputResult($( "#progressbar" ), score);
$("#inputPassword").bind("keyup", checkVal);
function outputResult(selecter, value)
{
selecter.progressbar( "option", "value", value);
var selector = "#progressbar > div";
$(selector).css({ 'background': 'Red' });
$(selecter).text(value + ' %');
}
You could create an inner span element to contain the text:
<div id="progressbar">
<span class="text">
</span>
</div>
And then define an appropriate style for that element:
.text {
color: white;
position: absolute;
}
Then in your outputResult function:
$("#progressbar").progressbar("option", "value", value);
$("#progressbar span.text").text(value + "%");
Here's a working example: http://jsfiddle.net/v48eP/
HI
I am using this demo to display a modal dialog
how do I set the width for dialog if i am using it for google street view:
var point = new GLatLng(svlat, svlon);
var panoClient = new GStreetviewClient();
panoClient.getNearestPanoramaLatLng(point, function (newPoint) {
if (newPoint == null) {
alert("no panorama found for this position!!");
return;
}
panoramaOptions = { latlng: newPoint };
myPano = new GStreetviewPanorama(document.getElementById("pano"), panoramaOptions);
$('#dialogStreetView').dialog("option", "maxWidth", 600);
$('#dialogStreetView').dialog('open');
GEvent.addListener(myPano, "error", handleNoFlash);
});
HTML:
<div id="dialogStreetView" title="Street View Provided by Google... " style="width:300px;height:300px">
<a id="closestreet-view" name="closestreet-view" style="cursor:pointer; text- decoration:underline" >Close</a>
<div name="pano" id="pano" style="width: 300px; height: 300px"></div>
</div>
From the docs:
http://docs.jquery.com/UI/Dialog
this should work:
$("#dialogStreetView").dialog( "option", "width", 460 );
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
$("#myDialogBox" ).dialog({
width: 500,
autoOpen: false,
show: {
effect: "blind",
duration: 1000
},
hide: {
effect: "blind",
duration: 1000
}
});
$( "#myBoxOpener" ).click(function() {
$( "#myDialogBox" ).dialog( "open" );
});
});
</script>
====== body ======
<div id="myDialogBox" title="My Dialog Box">
<div id="myContentLayer">
<p>My Content</p>
</div>
</div>
<button id="myBoxOpener" class="myButton">Open Dialog Box</button>
jsFiddle Demo
Is it just me does everyone except Porta have a syntax error:
$( "#selector" ).dialog( {
width: 500
} );
took from http://api.jqueryui.com/dialog/#option-width
simply just add width:500
$('#dialogStreetView').dialog( width: 500,"option", "maxWidth", 600);
I'm trying to load a YouTube video with Fancybox. It's working with all the browsers but it seems to have problem with IE7, it only shows a blank white page. I don't know what I've done wrong here, I tested there example online and it work with IE7, http://fancybox.net/blog. I also took my code from them.
So here's my markup on the homepage (where the video is located):
<a href="http://www.youtube.com/watch?v=sqC3tk_-e7g" title="The Problem" id="homevideo1">
<span class="playButton"></span>
<img width="170" src="/images/all/video-image1.jpg" alt="" />
<div class="videoTitle">The Problem</div>
</a>
and, this is my script for the video:
SetupVideos = function(){
$("#homevideo1").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 740,
'height' : 495,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {
'wmode' : 'transparent',
'allowfullscreen' : 'true'
}
});
return false;
});
}
It might be something to do with CSS, I'm not too sure... But I haven't touch the .css that comes with the plug-in at all
Any ideas?
Thanks.
You need to put your jquery click event in document ready, like this
$(document).ready(function(){
$("#homevideo1").click(function() {
$.fancybox({
'padding' : 0,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'title' : this.title,
'width' : 740,
'height' : 495,
'href' : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
'type' : 'swf',
'swf' : {'wmode':'transparent','allowfullscreen':'true'}
});
return false;
});
});
Try it live here (jsfiddle)
Synotte,
I too had problems with IE7 (not YouTube, but video embedding).
Removing the padding from the map worked for me, for some reason it was reducing the width of the video to zero.
May not be your issue, but worth a try.
Adam
I have the following piece of Mootools 1.11 code (not upgradable as this is within Joomla), which I want to highlight the form row, when an item within it is focussed. However, this doesn't work. I need to know how to access the parent div of the form item.
window.addEvent('domready', function() {
var list = $$('#ChronoContact_lensorder div.formrow');
list.each(function(element) {
var fx = new Fx.Styles(element, {duration:200, wait:false});
element.addEvent('focus', function(){
fx.start({
'background-color': '#e6f0f2',
color: '#FFF'
});
});
element.addEvent('focus', function(){
fx.start({
'background-color': '#FFF',
'color': '#2F9AD0'
});
});
});
});
HTML is:
<div class="formrow">
<label for="ud">Uncut Diameter:</label>
<input type="text" id="ud" name="ud" />
</div>
Thanks
Instead of looking for the <div>s, you might want to look for the actual <input> using var list = $$('#ChronoContact_lensorder div.formrow input'); Then refer to the parent using the .getParent() method when necessary, like this:
window.addEvent('domready', function() {
var list = $$('#ChronoContact_lensorder div.formrow input');
list.each(function(element) {
var fx = new Fx.Styles(element.getParent(), {duration:200, wait:false});
element.addEvent('focus', function(){
fx.start({
'background-color': '#e6f0f2',
color: '#FFF'
});
});
element.addEvent('blur', function(){
fx.start({
'background-color': '#FFF',
'color': '#2F9AD0'
});
});
});
});
Untested code. Note that the second event is now blur instead of focus, or else both events will fire at the same time and might revert each other's effects!