Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Screen name:
Daniel Ritiu
Daniel Ritiu's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Ideas
Problems
Expanded view
List view
Private Message
jQuery runs on Load instead of on Click event
[2Replies]
16-Mar-2016 02:27 PM
Forum:
Using jQuery
Hello,
I have the following code:
jQuery( function( $ ) {
// wc_single_product_params is required to continue, ensure the object exists
if ( typeof wc_single_product_params === 'undefined' ) {
return false;
}
// Tabs
$( '.wc-tabs-wrapper, .woocommerce-tabs' ).on( 'init', function() {
$( '.wc-tab, .woocommerce-tabs .panel:not(.panel .panel)' ).hide();
var hash = window.location.hash;
var url = window.location.href;
var $tabs = $( this ).find( '.wc-tabs, ul.tabs' ).first();
if ( hash.toLowerCase().indexOf( 'comment-' ) >= 0 || hash === '#reviews' ) {
$tabs.find( 'li.reviews_tab a' ).click();
} else if ( url.indexOf( 'comment-page-' ) > 0 || url.indexOf( 'cpage=' ) > 0 ) {
$tabs.find( 'li.reviews_tab a' ).click();
} else {
$tabs.find( 'li:first a' ).click();
}
});
$( '.wc-tabs-wrapper, .woocommerce-tabs' ).on( 'click', '.wc-tabs li a, ul.tabs li a', function() {
var $tab = $( this );
var $tabs_wrapper = $tab.closest( '.wc-tabs-wrapper, .woocommerce-tabs' );
var $tabs = $tabs_wrapper.find( '.wc-tabs, ul.tabs' );
$tabs.find( 'li' ).removeClass( 'active' );
$tabs_wrapper.find( '.wc-tab, .panel:not(.panel .panel)' ).hide();
$tab.closest( 'li' ).addClass( 'active' );
$tabs_wrapper.find( $tab.attr( 'href' ) ).show();
/*alert ($tab.attr( 'href' ));*/
window.alert('hello');
return false;
});
$( '.wc-tabs-wrapper, .woocommerce-tabs' ).trigger( 'init' );
$( 'a.woocommerce-review-link' ).click( function() {
$( '.reviews_tab a' ).click();
return true;
});
}
This is part of a WooCommerce website where I want to show tabs. Look at my site if it helps:
countryball.com/product/austriaball/
When I load my site the alert is displayed without needing to click anything. But when I click the specified items nothing happens. I've put there the alert just for testing (now I removed it). Do you have any idea what can be the problem?
«Prev
Next »
Moderate user : Daniel Ritiu
Forum