How to call the event of one element in another element in JQuery


Tags: javascript,jquery,html,css

Problem :

Here I have some CSS buttons over an image. Basically what is happening now is when I click on the image, the image is zooming onto one position. Now I need the same. The CSS buttons are in a different position on the image. Now when I click the buttons over the image, it should zoom onto that portion of the image.

I also want the same to happen onclick on another div.

Here is my code..

<script>
    $(document).ready(function(){
            $('#ex4').zoom({ on:'toggle',duration: 500 });
            $('.frame').css('width','100%');
                    $('#f1').zoom({ on:'toggle',duration: 500 });
    });
</script>

In the above code, I have a element that has id="ex4" and an image. When I click on the ex4 element the image zooms up. Similarly, when I click the #f1, the image in ex4 should zoom up. How can I do this?



Solution :

You need to Use trigger():

$("#ex4").trigger("click");

    CSS Howto..

    Jquery Ui Sortable showing broken image in IE8

    Best way how to put elements above an tag?

    How do I select columns including colspans in a table?

    how can I apply css based on parent div class

    How to fix the Height for this area?

    how to make this slide menu work

    How do I fix a Wordpress meta box that's blown out by it's content?

    How to DRY up on SASS transitions with multiple elements?

    How to write Text in css like show in images?

    how to set a div to the bottom side in asp.net css

    How To Center Align Menu Through CSS?

    How to include display:block in css code that includes pseudo element 'before'

    How can we avoid the shake when we hover over an element and set its border?

    How to deselect a table's head and certain tds with css

    How can I put styleName (css) on ui.xml to HTML5 input element (range)

    Show the menu at the center of the data toggle

    How to add a class to select_tag in Ruby on Rails

    How can I position list in
    ?

    how to not inherit? or how to reset inherited width to the value before? (css)

    How to make a background-color transition that eventually covers div to center? [closed]

    How to make a jsp page keyboard accessible and how to change the position of a popped up jsp page?

    how do i change a div background when you hover over a button in another div?

    How to position a background image in reveal.js?

    How to set background color of td in CSS

    How to handle CSS code in my Android email app?

    CSS - How to remove comments and make CSS one line

    How to differentiate between two class of same name in different css on same page

    how to position icon just after h2 tag using :after pseudo even though 100% width

    How to make last element in a series of wrapped inline-block elements fill the available horizontal space?

    I want to override some CSS that says border:none to have border bottom. How can I do this?