Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 951709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:46:47+00:00 2026-05-15T23:46:47+00:00

I’d like to mimick iPhone main screen in JavaScript on Safari / Chrome /

  • 0

I’d like to mimick iPhone main screen in JavaScript on Safari / Chrome / Firefox.

By mimicking I mean:
– Having a couple of pages
– Switching between the pages by clicking & dragging / swiping with my mouse
– Having those dots from the bottom iPhone main screen displaying which page it is

The closest to what I want is:
http://jquery.hinablue.me/jqiphoneslide/
But the sliding doesn’t work nearly as good as in iPhone (i have to slide first, and the animation appears after i release the mouse button), and there are no dots at the bottom.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:46:47+00:00Added an answer on May 15, 2026 at 11:46 pm

    I solved the problem by using jQuery & jquery.slide-0.4.3.js .

    jQuery Slide automatically slides between each page, so I had to add a mouse event (onMouseDrag) that stops automatic slide & reacts to user. It works very well.

    This is what I added to jSlide

    var jSlide = function(element, options)
        {
    
    
        element = $(element);
    
        $('ul.layers li', element).sliderDisableTextSelect();
    
        // my code here
    
        var dragging = false;
        var srcX;
        var offsetX;
        var diff; 
    
    
    
        this.manualDown = function(event) {
           dragging = true;
           srcX = event.pageX;
           offsetX =  parseFloat($('ul.layers li', element).css('marginLeft'));
    
           obj.settings.easing = "easeOutExpo";
    
           if(obj.settings.loopNr != null) {
               obj.toggleLoop(0);
           };
    
    
    
           return false;
        };
    
        this.manualMove = function(event) {     
           if (dragging) {
               diff = event.pageX - srcX;
               $('ul.layers li', element).css('marginLeft',(offsetX+diff)+'px');
               console.log((offsetX+diff)+'px');
           };           
           return false;
        };
    
        this.manualUp = function(event) {
          if (dragging) {
            dragging = false;
    
    
            if ((diff<-obj.settings.layerWidth/5) && (obj.settings.slidePos<obj.settings.layersSize-1)) {
                obj.slideTo(parseInt(obj.settings.slidePos)+1);
            } else if ((diff>obj.settings.layerWidth/5) && (obj.settings.slidePos>0)) {
                obj.slideTo(parseInt(obj.settings.slidePos)-1);
            } else { // if not slid far enough nor is it the last slide 
                obj.slideTo(obj.settings.slidePos);
            };
          };
        };
    
        this.manualLeave = function(event) {
          if (dragging) {
            dragging = false;
    
            if ((diff<0) && (obj.settings.slidePos<obj.settings.layersSize-1)) {
                obj.slideTo(parseInt(obj.settings.slidePos)+1);
            } else if ((diff>0) && (obj.settings.slidePos>0)) {
                obj.slideTo(parseInt(obj.settings.slidePos)-1);
            } else { // if it's the last slide 
                obj.slideTo(obj.settings.slidePos);
            };
          };
    
        };
    
    
        element.mousedown(this.manualDown);
        element.mousemove(this.manualMove);
        element.mouseup(this.manualUp);
        element.mouseleave(this.manualLeave);
    

    And also, to prevent text selection when dragging with mouse I added before jSlide class declaration:

      $.extend($.fn.disableTextSelect = function() {
            return this.each(function(){
                if($.browser.mozilla){//Firefox
                    $(this).css('MozUserSelect','none');
                }else if($.browser.msie){//IE
                    $(this).bind('selectstart',function(){return false;});
                }else{//Opera, etc.
                    $(this).mousedown(function(){return false;}); // this is handled in jSlide
                }
            });
        });
    
        $.extend($.fn.sliderDisableTextSelect = function() {
            return this.each(function(){
                if($.browser.mozilla){//Firefox
                    $(this).css('MozUserSelect','none');
                }else if($.browser.msie){//IE
                    $(this).bind('selectstart',function(){return false;});
                }else{//Opera, etc.
            //      $(this).mousedown(function(){return false;}); // this is handled in jSlide
                }
            });
        });
    

    I’m not sure if all the code is necessary… most probably you’ll still need to tweak it after pasting into jquery.slide, but it should get you started..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 470k
  • Answers 470k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I don't think you should let your domain assembly reference… May 16, 2026 at 2:55 am
  • Editorial Team
    Editorial Team added an answer with a projection: var result = ctx.Source.Where(...).Select(i => CostCentre ==… May 16, 2026 at 2:55 am
  • Editorial Team
    Editorial Team added an answer Try this function replace_links($content) { if (preg_match('#(http://[^\s]+(?=\.(jpe?g|png|gif)))#i', $content)) { $content… May 16, 2026 at 2:55 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.