0

I have some scroller menu like :

<div id="panel" class="scroller">
   <div class="scroller-view" style = left:-100>      
    <span class="item "></span>
    <a href="/123" class="item" style=""><img src="/images.png">123</span></a>
    <a href="/456" class="item" style=""><img src="/images1.png">456</span></a>
    <a href="/789" class="item" style=""><img src="/images2.png">789</span></a>
   </div>
</div>

I need when style = left:change from 0 to -300 load other class like:

when left:0 load class 123;
when left :-100 load class 456;
when left :-285 load class 789;

How I do that with c# ?

1
  • Are you building a image carousel? Commented Jun 18, 2013 at 8:19

2 Answers 2

1

You can try this Jquery solution. But you need to set a ID in Div.

 //Document Ready event
 $(document).ready(function () {
     if ($("#scroller-view").css("left") == "-100px") {
         $("#scroller-view").removeClass("scroller-view");
         $("#scroller-view").addClass("Class1");
     } else if ...
 });
Sign up to request clarification or add additional context in comments.

Comments

0

I think you are specifying the left by a stuation. For example Student.Age < 10, then left =0 and Student.Age >10 than left =-100. You are specifying this stuations in c# code. And now you have two selection,

  1. You can render your div panel in c# code.
  2. if you are using MVC, you can keep your left varibles in ViewBag.Left dynamic varible.

2 Comments

Tnks How i do that with 1 selection? so if (class == 123) style="left:-100" if (class == 456) style="left:-286" if (class == 789) style="left:-356"?
You can use TagBuilder TagBuilder label = new TagBuilder("label"); label.AddCssClass("control-label"); label.InnerHtml = propObj.LabelCaption;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.