1
    <style type="text/css">
        .style1
        {
            width: 50%; //must to be dynamically change == e.pageX
            height: 100%;
        }
    </style>

<script type="text/javascript">
    jQuery(document).ready(function () {
        $(document).mousemove(function (e) {
            $('.changes').val(e.pageX);
        });
    });
</script>

<asp:Image ID="Image1" runat="server" cssClass="changes style1"  ImageUrl="~/8.jpg"/>

How I can change with jquery width: **%; in style1 == e.pageX

Image width follow to mouse without any click and page reload.

3 Answers 3

1
jQuery(document).ready(function () {
    $(document).mousemove(function (e) {
        $('.changes').width(e.pageX);
    });
});
Sign up to request clarification or add additional context in comments.

Comments

1

You don't need to change the style val you just need to change the style width attribute value by using $("element").width()

You can do it like this:

<style type="text/css">
.style1
  {
    width: 50%; //must to be dynamically change == e.pageX
    height: 100%;
  }
</style>

<script type="text/javascript">
    jQuery(document).ready(function () {
        $(document).mousemove(function (e) {
            $('.changes').width(e.pageX);   // See the jQuery width [here][1]
        });
    });
</script>

<asp:Image ID="Image1" runat="server" cssClass="changes style1"  ImageUrl="~/8.jpg"/>

Comments

0

I think this is what you wanted:

jQuery(document).ready(function() {
    $(this).mousemove(function(e) {
        $('.style1').width(e.pageX);
    });
});

Here's a fiddle

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.