Tagged: 

Viewing 23 posts - 1 through 23 (of 23 total)
  • Author
    Posts
  • #507014

    Enfold v3.3.2 using child theme

    Hello,

    Please assist me to add click event handlers to the Pigments and Additives tabs in the Concrete and Asphalt sections of my development site.
    I require the handlers to run some jquery that changes the background image of the associated color section above. I have 4 images, concrete_p.jpg, concrete_a.jpg, asphalt_p.jpg, asphalt_a.jpg.

    I have tried adding some code (/js/mcl.js) that tests the click event trigger, but this did not work.

    Thanks.

    Michael Jones
    Micco Computing Limited

    #507075

    Hi _micco!

    did you use the code block element to include your click event? I think you could try to activate debug mode and include the shortcode of your code block element somehow as image link. Maybe it will work for you.

    Cheers!
    Andy

    #508039

    Hello Andy,

    I’ve put the click function attach code in script file ‘/js/mcl.js’. This has been registered and queued correctly.

    To test the jQuery operation I inserted a code block above the Concrete section tab control. It contains the code below:
    <style type=”text/css”> .code-block-div { color: yellow; background-color: blue; } </style>
    <div id=”code-block-div” class=”code-block-div”>click this div for an alert box</div>

    In my script file I have a click function bound to ID #code-block-div, this just pops up an alert box. THIS WORKS.
    I also have similar click functions bound to IDs #concrete-pigments-tab and #concrete-additives-tab but these do not trigger. These ID’s are the data-fake-id type. Is this causing the issue?

    As a further test, I wrapped the tab title for Additives in a div with ID #code-block-div as follows <div id=”code-block-div”>Additives</div>, this also did not work.
    I know the jQuery attach mechanism works but not for the tab control.

    Please could you look into this as I don’t know your code well enough to diagnose this myself.

    Regards,
    Michael

    #508224

    Hi,

    Could you please provide us with a temporary admin login so that we can take a closer look? You can post the details in the Private Content section of your reply.

    Regards,
    Rikard

    #508250

    Hello Rikard,

    Login details as requested.

    Michael

    #508774

    Hey!]

    I’m sorry but I’m not sure how the script is suppose to work. Can you please create a html test page so that we can get a better idea? What is the selector that use in the click event? If you’re trying to target the tab title, try this for example:

    div[data-fake-id="#asphalt-pigments-tab"]
    

    Regards,
    Ismael

    #508911

    Hello Ismael,

    I made a change to the site to show my requirement.

    In the Concrete section I have added two clickable divs, one for Pigments (blue background) and one for additives (red background), If you click the divs, the background image in the color section above the divs changes.

    I want the same effect when the Pigments or Additives tab title is clicked.

    It would appear that the click functions are not bound correctly for tab titles or something is preventing the trigger. Please view script file /js/mcl.js to see the binds I have tried and investigate the issue.

    Regards,
    Michael

    #509436

    Hi!

    Did you try the selector above? For the “Additives” title, try this:

    div[data-fake-id="#concrete-additives-tab"]
    

    We have to access the js file via FTP. Please post the ftp details as well.

    Cheers!
    Ismael

    #510772

    Hello Ismael,

    I tried the selector you provided, it didn’t work.
    Selectors tested include:
    jQuery(‘#concrete-pigments-tab’).click(function() {
    jQuery(‘div[data-fake-id=”#concrete-pigments-tab”]’).click(function() {
    jQuery(‘.tab_counter_0’).click(function() {

    In the Concrete section, I’ve changed the clickable divs for Enfold buttons. These change the color section background as required.
    The site is scheduled to go live on Thursday so I would appreciate a resolution soon. Thanks.

    Michael

    #511113

    Hi!

    Ignore my last post, I didn’t notice the ftp details in your last reply. We’ll give you an update after we check the scripts.

    Regards,
    Ismael

    #511121

    Hi!

    We transferred the code on functions.php file. You can check the page now (make sure you’re not looking on a cached version): http://procter.micco.co.uk/#asphalt-pigments-tab

    EDIT: The image http://procter.micco.co.uk/wp-content/uploads/2015/09/asphalt_p.jpg and http://procter.micco.co.uk/wp-content/uploads/2015/09/asphalt_a.jpg are the same.

    Regards,
    Ismael

    #511350

    Hi Ismael,
    Thanks !!!!!!!!
    Yes, the asphalt images are the same, I’m waiting for the new image from the design agency.
    Why didn’t the code work in a separate javascript file?
    I’m testing the site on an Android tablet and the section background doesn’t change like it does on a computer browser. Also the image sliding doesn’t work the same as a computer browser, they appear fixed. Is this expected?

    Michael

    #511890

    Hey Michael!

    On which browser (in Android) are you seeing these issues? please note that, at the moment we’re only supporting Chrome for Android.

    Regards,
    Josue

    #896370

    Hi,
    I’m having the same issue. I’m trying to have tab titles trigger some jquery to no avail. I see above that Ismael provided some modified code to the OP to rectify the situation. Is it possible I could obtain that code so that tab title can trigger jquery?
    thnx!

    #897758

    Hi,


    @waxingmedia
    : Please provide a link to the page with the tabs so that we can check it. What script are you trying to apply?

    Best regards,
    Ismael

    #897780

    Hi, Ismael

    Thanks for the reply. The url is in the private content area. If you scroll down to the first tab area, you will see a “button” above the tabs. If you click that, the bg image on that wrapper div will change. that is the behavior that I want, however, I want each of the tabs “sensor”, “dashboard” and “engage” to trigger the jquery as well and change the bg image.

    Below is the script I’m using. #testid is assigned to the small button above the tabs now and works fine. However, I also have #testid assigned to each of the tabs as well, but they don’t trigger the jquery. I’ve also tried targeting the fake-data-ids and even the unique classes., eg., .tab_counter_0 of each tab. Is there something I can change in tabs.php or a function I can add that will allow the tab divs to trigger the jquery? Any help would be appreciated!

    thnx!

    <script>
    $(document).ready(function(){
    $(“#testid”).click(function(){
    $(“#services-tab-1”).css(‘background-image’, ‘url(http://www.whiskerlabs.com/wp-content/uploads/2018/01/photo-services-ee.jpg)’);
    });
    });
    </script>

    #897820

    Hi,

    Did you try the following selector format?

    div[data-fake-id="#sensor"]
    div[data-fake-id="#dashboard"]
    div[data-fake-id="#engage"]
    

    Best regards,
    Ismael

    #897927

    Hi, Ismael
    I tried that as well. Nothing that I target in a tab div works. As you can see below, I even hardcoded id'”testid” into tabs.php to no avail.

    thnx!

    <div data-fake-id=”#sensor” id=”testid” class=”tab tab_counter_0″ itemprop=”headline”>SENSOR</div>

    #897950

    Hi, Ismael

    Here is some further info. I’ve put a link to a codepen I created of my page (static html, of course) and if you click on the “sensor”, “dashboard” and “engage” tabs, I can get the bg image of the container div to change. However, when it’s the wordpress site, nothing in those tabs will trigger jQuery. Again, any insight would be appreciated!

    thanks again!

    #898261

    Hi,
    Another update that might help. I did this as a test. if you load the page and click any div on the page, the first tab area’s bg image will change. Any div except the divs that are the tab titles. e.g.
    <div data-fake-id=”#sensor” class=”tab active_tab tab_counter_0″ itemprop=”headline”>SENSOR</div>
    none of these divs will trigger the javascript. It’s like jquery doesn’t see them or recognize them as divs. try loading the page and clicking any div and the bg image will change. Then reload the page and click any of the tabs… nothing.

    this is the script I used for the test.

    thnx!

    <script>
    $(document).ready(function(){
    $(“div”).click(function(){
    $(“#services-tab-1”).css(“background-image”, “url(http://www.whiskerlabs.com/wp-content/uploads/2018/01/photo-services-ee.jpg)”);
    });
    }); s
    </script>

    #898307

    Hi,

    Thank you for the update.

    Please create a new thread with the site url and the login credentials. We’ll check it there. Make sure that the Appearance > Editor panel is accessible.

    Best regards,
    Ismael

    #898341

    Hi, Ismael

    Thanks! I appreciate you guys looking into it. I’ve opened a new thread per your request with the login info. This is a staging version of the site.

    thanks again!

    • This reply was modified 6 years, 3 months ago by waxingmedia.
    #898923

    Hi waxingmedia,

    I just replied to you in that other thread.

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 23 posts - 1 through 23 (of 23 total)
  • You must be logged in to reply to this topic.