Cannot trigger click on class when selector change - select

I really appreciate if i got help this problem. I lost almost a week to find but i can't solve this
I knew i am not allowed to post link but if can please make it nofollow.
http://giayattom.com/san-pham/giay-sandal-da-ca-sau-cao-cap-at15-01
My target is when i click on number 1 on images also link to 1 on tab select (1 -- 1 ; 2--2; 3--3) (I did it thanks to this
$('ul.tabs-content a').click(function() {
var node = $(this).closest('#content');
var this_value = $(this).attr('title');
node.find('#pa_color').val(this_value).trigger('change');
return false;
})
But when i click on tab select it wont trigger click on images as i expect. Please help me solve this problem. Many thanks.
I used this
$("#pa_color").change(function () {
var this_class = $(this).val();
console.log(this_class);
$('ul.tabs-content a.'+this_class).trigger('click');
})

change $('ul.tabs-content a.'+this_class).trigger('click');
to $('ul.tabs-content a.'+this_class)[0].click();

Related

How to capture mouse click on Gtk.Stack

I would like to load the contents of a tab only when the user clicks on the same. Is there some property of the Stack or the Widget which I can use for this. I'm coding in Vala and I have currently worked around this by loading the content on the build of the UI. A sample piece of code will help a lot.
Thanks in advance !
Taken from OPs comment:
stack.add_titled (ports_layout_box, "my-tab", "FOO");
stack.notify["visible-child-name"].connect ((sender, property) => {
if ("my-tab" == stack.get_visible_child_name ()) {
// TO DO
}
});

trigger fancybox iframe without click but when a condition is met

Simple question, I dont think its possible but hopefully someone can proof me wrong.
Is it possible to trigger fancybox without a click but rather if an event is met
Example
if(balance<1){
#fancyBoxOpen
}
else{
Continue to page
}
Yes, it's possible.
You could create a function that triggers fancybox like :
var triggerFancybox = function () {
var content = "Sorry, the balance is less than 1";
jQuery.fancybox.open(content);
}
And call that function when your condition is met like :
if (balance < 1) {
triggerFancybox();
}
See JSFIDDLE
.... or another with a hard-coded condtion

can't tap on item in google autocomplete list on mobile

I'm making a mobile-app using Phonegap and HTML. Now I'm using the google maps/places autocomplete feature. The problem is: if I run it in my browser on my computer everything works fine and I choose a suggestion to use out of the autocomplete list - if I deploy it on my mobile I still get suggestions but I'm not able to tap one. It seems the "suggestion-overlay" is just ignored and I can tap on the page. Is there a possibility to put focus on the list of suggestions or something that way ?
Hope someone can help me. Thanks in advance.
There is indeed a conflict with FastClick and PAC. I found that I needed to add the needsclick class to both the pac-item and all its children.
$(document).on({
'DOMNodeInserted': function() {
$('.pac-item, .pac-item span', this).addClass('needsclick');
}
}, '.pac-container');
There is currently a pull request on github, but this hasn't been merged yet.
However, you can simply use this patched version of fastclick.
The patch adds the excludeNode option which let's you exclude DOM nodes handled by fastclick via regex. This is how I used it to make google autocomplete work with fastclick:
FastClick.attach(document.body, {
excludeNode: '^pac-'
});
This reply may be too late. But might be helpful for others.
I had the same issue and after debugging for hours, I found out this issue was because of adding "FastClick" library. After removing this, it worked as usual.
So for having fastClick and google suggestions, I have added this code in geo autocomplete
jQuery.fn.addGeoComplete = function(e){
var input = this;
$(input).attr("autocomplete" , "off");
var id = input.attr("id");
$(input).on("keypress", function(e){
var input = this;
var defaultBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(37.2555, -121.9245),
new google.maps.LatLng(37.2555, -121.9245));
var options = {
bounds: defaultBounds,
mapkey: "xxx"
};
//Fix for fastclick issue
var g_autocomplete = $("body > .pac-container").filter(":visible");
g_autocomplete.bind('DOMNodeInserted DOMNodeRemoved', function(event) {
$(".pac-item", this).addClass("needsclick");
});
//End of fix
autocomplete = new google.maps.places.Autocomplete(document.getElementById(id), options);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
//Handle place selection
});
});
}
if you are using Framework 7, it has a custom implementation of FastClicks. Instead of the needsclick class, F7 has no-fastclick. The function below is how it is implemented in F7:
function targetNeedsFastClick(el) {
var $el = $(el);
if (el.nodeName.toLowerCase() === 'input' && el.type === 'file') return false;
if ($el.hasClass('no-fastclick') || $el.parents('.no-fastclick').length > 0) return false;
return true;
}
So as suggested in other comments, you will only have to add the .no-fastclick class to .pac-item and in all its children
I was having the same problem,
I realized what the problem was that probably the focusout event of pac-container happens before the tap event of the pac-item (only in phonegap built-in browser).
The only way I could solve this, is to add padding-bottom to the input when it is focused and change the top attribute of the pac-container, so that the pac-container resides within the borders of the input.
Therefore when user clicks on item in list the focusout event is not fired.
It's dirty, but it works
worked perfectly for me :
$(document).on({
'DOMNodeInserted': function() {
$('.pac-item, .pac-item span', this).addClass('needsclick');
}
}, '.pac-container');
Configuration: Cordova / iOS iphone 5

alert handling in ui automation iphone app unable to cancel the option

system.logElementTree();
var target = UIATarget.localTarget();
target.onAlert = function onAlert(alert) {
UIALogger.logDebug("There was an alert!");
target.onAlert.buttons()["No"].tap({x:164,y:278});
return false;
even though no option is clicked systen not performing any action
Can anyone please help me ...
Instead of BamboOS suggestion which loops through various positions, you can try this inside your onAlert function:
alert.tapWithOptions({tapOffset:{x:0.5, y:0.6}});
This tap targets the middle of the UIAAlert (x:0.5) and 60% from top to bottom (y:0.6). This works when there is only one button. You have multiple buttons, then you have to changed the value of x. This works for me.
I just published a blog post regarding UI Automation and dealing with alerts:
http://www.conduce.net/Blog.aspx?f=Automated-Test-of-iPad-Apps
Basically following alert handler worked for me:
UIATarget.onAlert = function onAlert(alert){
var name = alert.name();
UIALogger.logMessage("alert "+name+" encountered");
if(name == "errorAlert"){
var positionX = 500;
for(var positionY=300; positionY<600;positionY+=10){
target.tap({x:positionX,y:positionY});
}
return true;
}
return false;
}
I would either use the "cancelButton" or "defaultButton" methods when handling alerts.

Ajax Auto Suggest v.2 suggestion depends on radio button?

I am using auto suggest v.2.1.3 from brandspankingnew.
I have a form with two radio button and a text field and would like to know how to make the auto suggest script pointing to a different php file if one of the radio button is checked.
I tried this but it doesnt work, its always point to the same php file even if second button is checked
Could you please assist?
Many thanks in advance.
My code is as follows:
function targetvalue()
{
for (i=0;i
/>Business Street
var options = {
script:"autosuggest.php?json=true&limit=6&",
varname:"input",
json:true,
shownoresults:false,
maxresults:10,
callback: function (obj) { document.getElementById('name').value = obj.id; }
};
var as_json = new bsn.AutoSuggest('business', options);
var options_xml = {
script: function (input) { return "autosuggest.php?input="+input+"&testid="+document.getElementById('testid').value; },
varname:"input"
};
var as_xml = new bsn.AutoSuggest('business', options_xml);
As for me, the easiest solution is to pass the the button state to the one script eg only one script but can return different results depending on button state. Otherwise you need to rewrite options each time someone clicks on the radio button. The second solution an lead to unpredictable behavior of auto suggest component.
Sample script:
var selectedValue = getRadioSelectedValue("radioGroupName");
var options_xml = { script: function (input) { return "autosuggest.php?input="+input+"&testid="+document.getElementById('testid').value+"&mode="+selectedValue; },
Write getRadioSelectedValue by yourself to get selected radio button value or set some flag on click. Mode param in GET request will indicates the state of the button, so you can return proper response.